C# Help

Started by G_G, September 15, 2009, 12:18:13 am

Previous topic - Next topic

G_G

Okay I'm making a dll in c# and the farthest I got was actually creating the class library.
I really dont know where to start so can anyone help me?

G_G

Dont worry about above question, I've figured out where to start.

anyways I'm having troubles. So I have an array that has Strings in it.
Now I also have a combobox and a method thats supposed to add every string thats
in the array into the combobox.
Anyone help me please?

Blizzard

combobox.Items.AddRange(stringArray);
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

hey blizzard any idea why a 2.0 C# project would fail to load the mscorlib.dll on a windows 2000 computer with .net 2.0 installed?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Maybe they changed that dll. I'm not sure .NET works on Windows versions before XP.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

hmm well the DL pages say 2000 is supported but almost nothing further back
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

IDK then. Try googling.
BTW, you can now post separate threads. :P
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Quote from: Blizzard on October 12, 2009, 05:30:43 am
combobox.Items.AddRange(stringArray);


K it worked but I just found out that wasnt the problem -_-
see this string array loads everyline from a text file and I dont think
I'm doing it right.


Blizzard

It may be best if you just find the method in FileStream that returns an array of strings that represent the lines in the text file.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

October 12, 2009, 02:50:19 pm #89 Last Edit: October 12, 2009, 02:56:40 pm by Ryexander

using System.Text.RegularExpressions;
string[] stringarray = Regex.Split(textstring, "\r\n");

that will create an array of strings if textstring is the entire text of a file with each string you want on a new line
or this is how i loaded the exstention names form the RMX-OS config file into an array


string[] EXTENSIONS = new string[] {""};
EXTENSIONS[extension_int] = namestring;
extension_int += 1;

and I started the extension_int at 0
useing this you just read each line of the file to a string load it in to the array at the extension_int index and then increase extension_int by 1 to move the next spot in the array for the next string.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

I don't think you need Regex for this. string supports the Split() method.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

oh good point
string[] stringarray = string.Split("\r\n") would do the same wouldn't it...
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

October 12, 2009, 03:06:00 pm #92 Last Edit: October 14, 2009, 04:55:23 am by Blizzard
Yeah, that should work.

EDIT: I'm locking this topic so people start posting new ones. -_-
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.