Quote from: game_guy on September 15, 2009, 12:18:13 am
Question 1
Okay so I want to be able to have bookmarks. So you can add things to a menu strip by doing this.
menuStrip1.Items.Add("Fruit");
Okay so here's my idea, I wanted to save all bookmarks in a file which I figured out how to do. Now my question is pretty much like the one with visual basic. So this is what I want to do.
# below is the text containing all bookmarks just for example
text = [bookm1, bookm2, bookm3]
# okay so thats three bookmarks
for i in 0...text.size
menuStrip1.Items.Add(i.tostring);
end
If that made any sense at all...Anyways I want it like that if anyone can help please that'd be great.
a few points:
use // instead of # for comments
C# uses real arrays, not the floating amorphic stuff of RGSS. Learn how they work, or else you are screwed.
semicolons
for loops
braces { } instead of ends
// below is the text containing all bookmarks just for example
string[] text = {"bookm1", "bookm2", "bookm3"};
// okay so thats three bookmarks
for (int i = 0; i < text.Length; i++)
{
menuStrip1.Items.Add(text[i]);
}
(for all those coders out there, I know I could have used an extended for loop, but I think he should know the regular ones first.)
Quote from: game_guy on September 15, 2009, 12:18:13 am
Question 2
Okay when my browser is done I'm going to make a help file for it. So this is kind of two questions.
How would I open this helpfile? I have a top tool bar that has a Help button on it so I want that to open the help file.
Next how would I just open this helpfile by pressing F1 or something?
you are going to need to add a keyboard event listener, then make an onKeyboardEvent method. But you have no idea how interfaces and stuff work, so good luck. I'd ask when you get there.
Quote from: game_guy on September 15, 2009, 12:18:13 am
Question 3
Next okay so how would I go replacing all the spaces in a line of text? Like the url says this
How would I replace that space with nothing or with a different letter/symbol? Something like this in ruby.
name = "Alu x es"
name.delete!(" ")
that would delete all the spaces but not only do I want to do that I want to be able to replace that space with a letter or symbol. Is is possible and if so how?
There is an easier way with regex, but I don't know if you will be ready for it, so I'll give you a method that splits and recombines:
string s = "Al u xes";
// replace the ' ' with whatever character to split at. It's an array, so you can split at any number of characters.
char[] delim = { ' ' };
string[] ssplit = s.Split(delim);
string snew = ssplit[0];
for (int i = 1; i < ssplit.Length; i++)
{
//replace the '-' with whatever you want to replace the space
snew += "-";
snew += ssplit[i];
}
at the end, snew has the new string, which in this case, is Al-u-xes.