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 1, 2  Next
 
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
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sat May 05, 2007 1:40 am    Post subject: tcsoccerman's General Questions Reply to topic Reply with quote

Instead of jumping over two topics, condense into here.
Back to top
View users profile Send private message Add User to Ignore List Send email
tcsoccerman
Server Help Squatter


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

PostPosted: Sat May 05, 2007 8:26 am    Post subject: Reply to topic Reply with quote

Lol, thanks MGB. how would you put a variable into text, something like this in C:

Code: Show/Hide

int nbr1;
printf("Enter a number:\n");
scanf("%d", &nbr1);
printf("you typed in %d", nbr1);
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: Sat May 05, 2007 8:39 am    Post subject: Reply to topic Reply with quote

Wow, so fustrating. I'll show you the method i declared:

Code: Show/Hide
void definitions(string english)
      {
         if (textbox.Text == "aprender")
         {
            labeldef.Text = "%s means %s";
         }
   }


and when i made a reference to it:

Code: Show/Hide
void ButtonClick(object sender, EventArgs e)
      {
         labeltitle.Text = textbox.Text;
         toolStripStatusLabel.Text = "Finding Definition...";
         definitions(to learn);
      }


and it gavbe me these errors:

Quote:
Invalid expression term ')'
; expected
) expected (CS1026)


and they all said in line 52, which is

Code: Show/Hide
definitions(to learn);


ty for any help.
_____________
btw, when i took that line out it compiled correctly icon_eek.gif icon_exclaim.gif icon_surprised.gif icon_eek.gif icon_rolleyes.gif
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat May 05, 2007 11:37 am    Post subject: Reply to topic Reply with quote

if 'to learn' is meant to be a string, you have to put it inside "quotes"
Code: Show/Hide
definitions("to learn");

and C# doesn't use any of these %s %i you were using with printf... it's actually much more intuitive than that...
Here's an example of using strings:

Code: Show/Hide

string GetDefinition(string word)
{
   if (word == "you")
      return "tu";
   else if (word == "bleh")
      return "bah";
   else
      return "unknown word";
}

void ButtonClick(object sender, EventArgs e)
{
    labeltitle.Text = textbox.Text;
    toolStripStatusLabel.Text = "Finding Definition...";
    int someInteger = 8;
    labelDefiniton.Text = "Definition of " + labelword.Text + " is " + GetDefinition(labelword.Text) + ", and the value of someInteger is " + someInteger.ToString();
}


Basically you just use '+' between parts of your string, and every litteral (string value that will not ever change during execution) must be "in quotes"
_________________
(Insert a bunch of dead links here)
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: Sat May 05, 2007 11:51 am    Post subject: Reply to topic Reply with quote

Yep figured that out, but ty, that's exactly what i was asking. But since this is sorda gonna be a big database type thing, i was going to make a .cs file fora each type of word, for example, my first one will be for verbvs. i simply copyed and pasted, made the method a public method, but i get this error when i compiled:

Code: Show/Hide
Type or namespace definition, or end-of-file expected (CS1022)


it is referring to the last line of the file, where a "}" is underlined as the error. what does it mean?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat May 05, 2007 12:10 pm    Post subject: Reply to topic Reply with quote

make sure there's a corresponding opening bracket for it... either an opening bracket is missing, either that last one shouldn't be there

you should have something like:

Code: Show/Hide
namespace blahblahblah
{
   class blahblah
   {
      void myMethod()
      {
      }

      void someOthterMethod()
      {
      }
   }

}
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: Sat May 05, 2007 12:12 pm    Post subject: Reply to topic Reply with quote

i'll check over that again. last question, then i'm leaving. what would i do to make it after they type in the word to be translated, when they press enter, it does the button clickevent. kinda like the google thing, just to make it easier to use.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sat May 05, 2007 2:54 pm    Post subject: Reply to topic Reply with quote

In the properties of your form, you will find 'AcceptButton' and 'CancelButton'. AcceptButton is the button to be pressed when you press Enter anywhere in the form, and CancelButton is the one for when you hit Escape
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: Sat May 05, 2007 3:44 pm    Post subject: Reply to topic Reply with quote

That's not in csharp dev, the one doc flabby suggested. it can wait though.
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 May 08, 2007 5:53 pm    Post subject: Reply to topic Reply with quote

would it be possible to make a function, in a function that is being made, something like this:
Code: Show/Hide

void textchoose(int labelnbr)
{
   void definition(string spanish, string english, string verbending)
   {
   ....
....
   }
}


andthen reference to it like this:

Code: Show/Hide

textchoose(1);
textchoose(2);
textchoose(3);


the purpose is to ahve multiple textboxes to type into, and then you can type phrases in as well.
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 May 08, 2007 7:00 pm    Post subject: Reply to topic Reply with quote

No, that's not possible in C#, but explain a bit more what you're trying to do and there may be a better 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: Tue May 08, 2007 9:56 pm    Post subject: Reply to topic Reply with quote

I'm making a spanish translator, that will have 3 textboxes to enter a word into. there will be a button for each of those textboxes. then there will be a button that looks at all 3 words and translates the phrase vs. the sepreate words(spanish wording is different than english). i want to use the same function for each button so that when i edit one, i don't have to edit each other. i figured i must be specific in which textbox, and thought of the idea above. if this is not clear it's because i am in a hurry, and will answer any questions tom.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Doc Flabby
Server Help Squatter


Joined: Feb 26 2006
Posts: 636
Offline

PostPosted: Wed May 09, 2007 4:43 am    Post subject: Reply to topic Reply with quote

You can do this, you just assign the same event to each button. But then use the "sender" object to obtain the correct result
_________________
Rediscover online gaming. Get Subspace | STF The future...prehaps
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: Wed May 09, 2007 9:25 pm    Post subject: Reply to topic Reply with quote

Can you describe how i would do this. maybe add some sample code.
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: Thu May 10, 2007 9:19 pm    Post subject: Reply to topic Reply with quote

if i were to do this in C:

Code: Show/Hide

void definitions(int textboxnumber)
{
[u]   textbox[textboxnumber].Text = "test"
[/u]}

how wouldi do the underlined part, particarily the

Code: Show/Hide
textbox[[u]textboxnumber[/u].Text

part in c#?
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: Fri May 11, 2007 8:39 pm    Post subject: Reply to topic Reply with quote

Nobody is answering my questions, but anyways, i am moving along quite well w/ my program, and it's of course a spanish translator. First i'll describe how it works.
1.Type in a word.
2.Click the translate Button
3.Or Press Enter(although i'll describe this more later)
4.It shows the parameters of the definition function(not part of problem, describing vaguely).


Ever since i added the key press event, it reads the text to translate as you erase it. for example, if i entered

to learn

it shows up all the translation, and how to say it such as yo aprendo, tu aprendes, etc.
then when it turns to

to lear

(from backspacing). it shows my "else" coding(meaning, if it doesn't recgonize the word). thsi is a problem because my else coding says to make it say it wasn't found, and suggests help. this is 1. unproffesional like, and 2. makes my program much more incomplete. if you could think of a way of only recgonizing the <ENTER> key press, and not backspace/letters/any other button that would be great.
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: Sat May 19, 2007 4:30 pm    Post subject: Reply to topic Reply with quote

I'm working on a new project(a team tracking program) and i've gotten farther than i ever expected. i learned how to save txt and how to make new forms, and apply 1 forms user entered variables to the main form. anways, i'm having a problem b/w forms.

When you click the "new" button, it gives you a new form asking things such as the teamname, tream city, team coach, etc. when the user clicks ok, it collects all the txtbox.text in each category and sets that to a value. that value then becomes a labels text in the main applicatoin/mainform. the problem i'm having is closing the OLD mainfrom. i'll post my coding here.

My "new" event handler form too enter new info:
Code: Show/Hide
private void Button1Click(object sender, EventArgs e)
      {
         string teamname, teamcity, teamcoach, teamacoach1, teamacoach2, teamleague;
         teamname = txtboxcreateteamname.Text;
         teamcity = txtboxcreateteamcity.Text;
         teamcoach = txtboxcreateteamheadcoach.Text;
         teamacoach1 = txtboxcreateteamassistantcoach.Text;
         teamacoach2 = txtboxcreateteamassistantcoach2.Text;
         teamleague = txtboxcreateteamleague.Text;

         this.Close();
         MainForm frm = new MainForm(teamname, teamcity, teamcoach, teamacoach1, teamleague);
          frm.Show();
      }


and my mainform method:
Code: Show/Hide
      
      public MainForm(string tmname, string tmcity, string tmcoach, string tmacoach, string tmleague)
      {
         InitializeComponent();
         lblteamname.Text = tmcity+"  "+tmname+"\n"+tmcoach+tmacoach;
         lblawayrecord.Text = "0-0-0";
         lbloverallrecord.Text = "0-0-0";
         lblhomerecord.Text = "0-0-0";
         lblplayercount.Text = "0";
         
      }

any ideas appreciated.
this is c# code under "sharpdevelop" compiler.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Mon May 21, 2007 12:55 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide
private void Button1Click(object sender, EventArgs e)
      {
         string teamname, teamcity, teamcoach, teamacoach1, teamacoach2, teamleague;
         teamname = txtboxcreateteamname.Text;
         teamcity = txtboxcreateteamcity.Text;
         teamcoach = txtboxcreateteamheadcoach.Text;
         teamacoach1 = txtboxcreateteamassistantcoach.Text;
         teamacoach2 = txtboxcreateteamassistantcoach2.Text;
         teamleague = txtboxcreateteamleague.Text;

         this.Close();
         MainForm frm = new MainForm(teamname, teamcity, teamcoach, teamacoach1, teamleague);
          frm.Show();
      }


You don't have to declare string variables for that... you could just pass the .Text values

And I'm not sure if Close() clears stuff from memory... I'd use .Dispose(), but after the new form is shown cause no code would be executed after the Dispose (I think)
In this case, it works because frm is not shown as a modal dialog
If you'd want the first window to stay, but be disabled, you'd use:
frm.ShowDialog(this);

Code: Show/Hide
private void Button1Click(object sender, EventArgs e)
      {
         MainForm frm = new MainForm(txtboxcreateteamname.Text,
                                                   txtboxcreateteamcity.Text,
                                                   txtboxcreateteamheadcoach.Text,
                                                   txtboxcreateteamassistantcoach.Text,
                                                   txtboxcreateteamleague.Text);
          frm.Show();
          this.Dispose();
      }
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: Mon May 21, 2007 3:31 pm    Post subject: Reply to topic Reply with quote

the only problem as i believe i stated b4 is that i'm trying to close another form, not the form that function is in. i have that "button1clickbuttonevent" in the form "addteam". i want to close the old "mainform", not "addteam".it's closing a form from another form.

also if you could answer other posts/questions i made that be greate too icon_smile.gif.
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 May 22, 2007 3:40 pm    Post subject: Reply to topic Reply with quote

Ok, new problem, even though NOBODY RESPONDS. Lol, w.e., you don't have to. I'm trying to assign an integer to a label, and beable to retrieve that value at other times.

I want to do this to keep a record(wins-losses-ties). Everytime i call the function it retrieves the labels value and adds 1. I don't know how to do this w/ labels. i know i can do it w/other things, but they aren't what i need(updownlistboxthing is one way). Any help appreciated.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:36
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Thu May 24, 2007 8:29 pm    Post subject: Reply to topic Reply with quote

tcsoccerman wrote:
...NOBODY RESPONDS. Lol, w.e., you don't have to.


Lol, I'd help, but I don't know how. icon_sad.gif I just realized how much time I've been wasting this summer, too. Anyway, just think of it as helping the next guy who might have these problems.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
tcsoccerman
Server Help Squatter


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

PostPosted: Fri May 25, 2007 5:18 pm    Post subject: Reply to topic Reply with quote

could someone give an example of child/parent forms using...

MainForm()//mainform
AddTeam() //this is the child form


and there is a variable in AddTeam() (this is the child form)called "teamnametxtbox.Text" that i want to pass to the mainform(MainForm) and make it = "lblteamname.Text". That would be pimpin. Sampapico rocks. Oh, btw, i attached the program in topic "Team Tracker Program, version 1.0". I learned how to save . a biggie is not having a new form opening when the variables change, but just replacing the variables. I will attach the source and program here (it's slightly updated from the one in "leage manager" post). Thank you much.




Application

Team Tacker v.1.1.zip - 19.06 KB
File downloaded or viewed 44 time(s)

Source code

Team Tracker 1.1.zip - 121.58 KB
File downloaded or viewed 44 time(s)
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: Sat May 26, 2007 11:17 am    Post subject: Reply to topic Reply with quote

I don't mean to be rude, but I'll say it how it is. Nobody is responding to you because you continue to ask very basic questions that could easily be worked around with a bit of ingenuity, looking at the API, and Google searching.
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: Fri Jun 08, 2007 5:50 pm    Post subject: Reply to topic Reply with quote

I'm pretty sure it's been long enough to ask another question now icon_smile.gif.

Does anyone have an idea/attempt on how i could incude players in my Team Tracker (TT) program? i thought of structures at first but i don't know if they are available in c#. ty.(again)
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: Fri Jun 08, 2007 8:56 pm    Post subject: Reply to topic Reply with quote

Make a class, similarly to C++.

Code: Show/Hide
class Player
{
int foo;
int bar;
};


Then instantiate it with "Player p = new Player();".
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
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 1, 2  Next
Page 1 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: 679 page(s) served in previous 5 minutes.

phpBB Created this page in 0.515825 seconds : 52 queries executed (74.4%): GZIP compression disabled