Lack of examples, since everyone that's tried hasn't really known what they were doing.
tcsoccerman - Fri May 04, 2007 2:27 pm
Post subject:
Could someone tell me what a function in C/C++ would be in c#. that way i can look into it more. i'm guessing it's a class or an object by what the tutorial is saying. it be nice to have a comparision is all.
Mine GO BOOM - Fri May 04, 2007 7:43 pm
Post subject:
Functions in C# are called methods. If you want a generic function like making your own power of two:
int pow2(int number)
{
return number * number;
} |
static class MyMath
{
static public int pow2(int number)
{
return number * number;
}
} |
The static means you can call the function by name MyMath.pow2(3) without having to do anything special about classes. Everything has to be inside a class, but those classes don't have to be treated like objects.
tcsoccerman - Fri May 04, 2007 10:28 pm
Post subject:
another question, if i wanted to add text into a text box, instead of declaring the text like this:
textbox.Text = label1.text |
what would i do? i suppose you could obtain the current text and then declare the next text;something like this:
textbox.Text = old_text;
textbox.text = "%s%s", old_text, new_text; |
the only problem there is that i don't know if that is correct in line 2, i'm just using my C language knowledge, i'll have to look more into that.
Samapico - Sat May 05, 2007 1:12 am
Post subject:
string newtext = "thisisnewstuff";
textbox.Text = textbox.Text + newtext; |
or
string newtext = "thisisnewstuff";
textbox.Text += newtext; |
would work as well
tcsoccerman - Mon May 14, 2007 9:10 pm
Post subject:
back to the idea of savedialog and open dialogue.
i got it to work, although, i am required to have a textbox named "txtSource" on my application according to this website:
http://www.samspublishing.com/library/content.asp?b=STY_Csharp_24hours&seqNum=178&rl=1
i KNOW theres a way w/out a textbox. could someone explain where im going wrong? gracias.
Mine GO BOOM - Tue May 15, 2007 12:51 am
Post subject:
That is only an example they use to show you that it selected that file. You can save the open dialog result to any string variable.
tcsoccerman - Tue May 15, 2007 6:21 pm
Post subject:
Ok, so i don't even need that coding? I'll try that. Also, my savedialogue doesn't seem to work. It acts as if it is saving, but when i go to open it it isn't there. Do i need to code the saving part?
Bak - Tue May 15, 2007 7:36 pm
Post subject:
yes, all the save dialog will do it tell you where they want to save the file.
tcsoccerman - Tue May 15, 2007 9:19 pm
Post subject:
Ok, i've been trying really hard to do the save and open thing. i've been using FileWrite file = .... and StreamWrite...and sr.close and all that, but i just can't seem to get a hang of it. Right now, all i need is someone to make a project that simply has a textbox and opens and saves files. nothing else is required, it's best the mroe simple it is. the buttons can be sloppy if you want even. ty very much, this will expand my possibilities by a mile!(or two).
p.s. i use sharpdevelop compiler, but i don't think it matters.(c#)
Mine GO BOOM - Tue May 15, 2007 10:03 pm
Post subject:
5 minutes with Google, and I created this.
tcsoccerman - Wed May 16, 2007 5:16 pm
Post subject:
I try and extract all, but than it says no files exist???? i use winzip i'm pretty sure.