Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
tcsoccerman's General Questions
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  Official Team Tracker Forum Post :: Post School note taker  View next topic  
Author Message
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sat Jun 09, 2007 5:16 pm    Post subject: Reply to topic Reply with quote

Thank you for that cyan, but as i look farther into this problem, the more sloppy i see my solution. i then thought of another solution, of not looking to variables for a players name, goals, assists, age, etc., but instead look to a text file. that's how i do my teamdata right now. let me know if this would be a better solution. otherwise, i would have to make a struct/andor method and or class for every player. new_let_it_all_out.gif icon_eek.gif . ty for any suggestoins.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
baseball43v3r
Seasoned Helper


Joined: Jan 02 2006
Posts: 102
Offline

PostPosted: Sun Jun 10, 2007 2:40 am    Post subject: Reply to topic Reply with quote

it would be the same thing. it matters in how you call the data you want to use.

your hierarchy would be something like this.
Code: Show/Hide

                     PERSON
                  /      \   
               Player      Manager   
                 /      \         \   
               Forward      Goalie      Coach

and as you create the classes you create the fields specifc to each person and when you reference it you reference it by class. Hope this helps
Back to top
View users profile Send private message Add User to Ignore List AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sun Jun 10, 2007 2:53 pm    Post subject: Reply to topic Reply with quote

Not really, you're arrows are messed up i think.... I've decided that's what i'll do though anyways. I'll start on it and let you know what i run into.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sun Jun 10, 2007 4:27 pm    Post subject: Reply to topic Reply with quote

I'm getting a buggy error right now:
Code: Show/Hide
The process cannot access the file 'C:\Program Files\Team Tracker\ Logo' because it is being used by another process.

I realize what it means, but i can't seem to figure out the problem. This is happening when i change photos of either the team photo, or the player photo. I use the same variables for each form, since they are in different classes. that way i could copy+paste. Here is the team photo's "picdialogbox2ok" code:
Code: Show/Hide
void OpenpicDialog2FileOk(object sender, System.ComponentModel.CancelEventArgs e)
      {
         source = openpicDialog2.FileName;
         Stream openbmp =openpicDialog2.OpenFile();
         StreamReader openerbmp = new StreamReader(openbmp);
         openpicDialog2.Dispose();
         teamlogopicturebox.Image = new Bitmap(source);
         if (File.Exists(destination+lblteamname.Text+" Logo"))
         {
            File.Delete(destination+lblteamname.Text+" Logo");
         }
         System.IO.File.Copy(source, destination+lblteamname.Text+" Logo");
         photologo = destination+lblteamname.Text+" Logo";
         teamlogopicturebox.Image = new Bitmap(source);
}


and....the one for the player is the same, so i won't post that too. by the way, this is the only error i'm recieving. ty.


Last edited by tcsoccerman on Sun Jun 10, 2007 5:22 pm, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Sun Jun 10, 2007 4:32 pm    Post subject: Reply to topic Reply with quote

I have more info, i realize that when an actual file isn't opened, and i'm just randomly changing the photo, it works w/ out an error. Then, i open a file(which has a photopath in it's text) and change the files photo, and then get an error. hope this helps. it helps me....

I also found out it's the File.Delete part that is throwing the error.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Tue Jun 12, 2007 9:20 pm    Post subject: Reply to topic Reply with quote

That's an awfully strange path, does the file even exist? If it does, you're probably opening it somewhere and not closing it.

This is the best way of closing a file when you're done with it, as the system will destroy the StreamReader right after the using block:
Code: Show/Hide
using (StreamReader foo = new StreamReader("file.txt"))
{
   string yayForLotsOfPointlessHeapAllocations = foo.ReadLine();
}


Another way of doing the same thing would be:
Code: Show/Hide
StreamReader foo = new StreamReader("file.txt");
string yayForLotsOfPointlessHeapAllocations = foo.ReadLine();
foo.Close();


but the first one is the recommended method.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Jun 13, 2007 10:35 pm    Post subject: Reply to topic Reply with quote

Just so you know, i'm almost ready to release the new team tracker, but w/ players icon_smile.gif. If you want to speed up the process(most likely not) you could post a reply here telling me about arrays so i don't have to google. That would be sweet. Otherwise that's cool.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Jun 20, 2007 9:20 pm    Post subject: Reply to topic Reply with quote

As i am coding more, i don't seem to enjoy having so much code on one page. therefore, i've tried adding a new page something like this:
the new file would have this:
Code: Show/Hide
namespace Team_Tracker
{
   public partial class MainForm : Form
   {
      public players()
      {
         InitializeComponent();
      }

      yadayadayada void money(blah, blah)
      {
      }
   }
}

and the one that has to much code/original would have this:
Code: Show/Hide
namespace Team_Tracker
{
   public partial class MainForm : Form
   {
      [STAThread]
      public static void Main(string[] args)
      {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Application.Run(new MainForm());
      }
      
      public MainForm()
      {
         InitializeComponent();
      }

      //lots of code
      //too much code
   }
}

would that be correct?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Jun 21, 2007 12:17 am    Post subject: Reply to topic Reply with quote

I don't really understand what you're trying to do. Can you clarify? (And fix the horrible tabbing in the first code block, please.)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Aug 22, 2007 7:45 pm    Post subject: Reply to topic Reply with quote

hey there i'm back with this project now.
i've learned alot since the last time i tried. i'm now working on something that cyanfire suggested back on making a class:

class Player
{
int blah;
string foo;
};

i've run into one problem. i need to find a way to instintate the class, naming it by the players name. it will look something likethis:

Player <playernamehere> = new Player();

the problem is, i don't know how to "insert" the players name.
In c there is a snprintf() function, (commonly including the string buf) that can help with these sort of problems, or others like it. google searches didn't relate snprintf with c# icon_sad.gif. can anyone help me think of a way of inserting the players name?

EDIT:also i can't acces the file due to protection levels :\. I think i'm gonna just take the old approach to it.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Aug 23, 2007 12:40 am    Post subject: Reply to topic Reply with quote

Lookup C# constructors.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Tue Aug 28, 2007 7:14 pm    Post subject: Reply to topic Reply with quote

i did as you said and that really isn't what i wanted, but it was helpful in other ways. basically i'll give it straight out.

instead of having to do

player Bob = new player();

or

player hannah = new player();

or some other SET name, i want to do something like this:

player txtboxname.Text = new player();

excepty you can't do that, becasue "txtboxname.Text" gives an error. how can i do this correctly?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Tue Aug 28, 2007 7:42 pm    Post subject: Reply to topic Reply with quote

ok i've found my answer finally, by searching keyword "objects" at msdn
here's the coding.

Code: Show/Hide
System.Windows.Forms.TreeNode lb;
   if(team1players.Focused == true)
   lb = team1players.SelectedNode;
   else
   lb = team2players.SelectedNode;
   object name;
   name = lb.Name;
   name = new player();


i'm glad to say i found a reason for object oriented programming finally! icon_smile.gif.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Aug 29, 2007 1:15 pm    Post subject: Reply to topic Reply with quote

OK, I really have to ask this. Did you really do any kind of C# tutorial before you started this stuff? It seems to me like you are copy+pasting and modifying code without any kind of understanding of what it actually does...
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Aug 29, 2007 10:51 pm    Post subject: Reply to topic Reply with quote

you're half right half wrong.

i took no tutorial.
i learned c programming before c# though, so i have the basics(or do i) down. i do understand what i'm doing for the most part, it's just my c# dictionary is very small. here's how it works for me

code
find problem
google problem
google
google
google
ask this topic
solved

ty for answering though. and if you're wondering, i do realize that the above post is wrong, and missing some code. i got that code though. ty for you're help so far.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Wed Aug 29, 2007 11:41 pm    Post subject: Reply to topic Reply with quote

Do a tutorial. Your questions have indicated a lack of basic understanding of the language and it would be good for you to sort of start over, sorry to say it. icon_confused.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Wed Aug 29, 2007 11:52 pm    Post subject: Reply to topic Reply with quote

ok i will do a tutorial, but one quick question. how can you access already existant created instances of classes without using the "new" operator?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Aug 30, 2007 7:12 am    Post subject: Reply to topic Reply with quote

You create a instance of a object when you use the 'new' operator.

You'll need to keep the object reference around to use elsewhere.
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Thu Aug 30, 2007 10:52 am    Post subject: Reply to topic Reply with quote

ok thank you.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 643 page(s) served in previous 5 minutes.

phpBB Created this page in 0.605774 seconds : 44 queries executed (80.5%): GZIP compression disabled