C# Help

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

Previous topic - Next topic

G_G

September 15, 2009, 12:18:13 am Last Edit: September 15, 2009, 11:47:32 pm by game_guy
Okay well I decided to remake the browser in C# I'm liking it already. Anyways I need some help. So here's the questions.


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.


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?


Question 3

Next okay so how would I go replacing all the spaces in a line of text? Like the url says this

you tube.com

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?

winkio

Not really familiar with visual basic, but an ITERATOR is what you need.  Find one, make one, use one.

fugibo

Quote from: game_guy on September 15, 2009, 12:18:13 am
Okay so how would I only get text from the 3rd line? I know how to get the whole text file but I would only like to get the 3rd text line. Is it possible if so how?

I'll have more questions up here as soon as I can manage to fit them into understandable questions -_-


Doesn't .NET have Regular Expressions?

Blizzard

I don't think there is a serious programming language that does not have regex.
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.

fugibo

Quote from: Blizzard on September 15, 2009, 10:05:00 am
I don't think there is a serious programming language that does not have regex.


C.

Blizzard

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.

scoace13

you could try reading the file in a loop and writing each line to a variable and then clear the other two...thats generally how i read specific lines. in vb....i cant get you the code for such a thing cause it's been two + years since my last VB class and i don't remember every thing too well.
scoace13, Eventman extrodnaire...so anybody seen any good movies recently <br />...whys is this here..........random fate...same reason im here...

Blizzard

So what you want is basically reading a file where every line that starts with # is treated as comment and should be skipped?
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

yea that and there will be more lines then that to

I'll try to google some more

fugibo

Quote from: game_guy on September 15, 2009, 06:11:31 pm
yea that and there will be more lines then that to

I'll try to google some more


You should really be using C++, there's no reason to limit yourself with VB. In C++, this would be simple.

G_G

yea I know more visual basic then c++ and the only things I do know in c++ is the command prompt thing

fugibo

Quote from: game_guy on September 15, 2009, 06:54:07 pm
yea I know more visual basic then c++ and the only things I do know in c++ is the command prompt thing


Well then, IronRuby.

G_G

September 15, 2009, 07:14:02 pm #12 Last Edit: September 15, 2009, 07:22:42 pm by game_guy
so is that using ruby in visual basic or c++?

EDIT:
Does anyone know how you could do this in C#?

fugibo

Quote from: game_guy on September 15, 2009, 07:14:02 pm
so is that using ruby in visual basic or c++?


You know what .NET is, right? It's built on top of the Common Language Runtime, or CLR - a sort of engine that allows for you to use any languages you want together on top of .NET. IronRuby is a port of Ruby to the CLR, meaning you can use it together when any other .NET language you want, as well as use .NET itself. All from within the language you probably know best, Ruby.

G_G

OKay so where would I edit the code then? In a ruby compiler, visual basic, or what? I'm still confused a bit.

Thanks tho LF for helpinh

jcsnider

If you are using Vb.. make a module and add a GETvar and Putvar sub, so that you cna read/write to ini files, then make the text file an ini file... which is alot better and in windows it is classified as a cfg file... it has been awhile since I have done it but it would work for what you want...

G_G

September 15, 2009, 07:55:31 pm #16 Last Edit: September 15, 2009, 07:59:10 pm by game_guy
I know how to read from a .ini file but how do I write to it?

Here's the read code.
Dim ini As New IniFile(FileName)
Dim value As String = ini.GetString("SectionName", "KeyName", "Default Value")


Well and I have a class that has that. But I dont understand how to write to it

jcsnider

Probably same thing but ini.Putstring

Not sure, I always go featch code from google and it tells me how to use it, i never really remember it either

fugibo

Quote from: game_guy on September 15, 2009, 07:24:05 pm
OKay so where would I edit the code then? In a ruby compiler, visual basic, or what? I'm still confused a bit.

Thanks tho LF for helpinh


Like I said, it's just programming for .NET in Ruby. You use VS and everything - exactly the same as with Visual Basic, but with Ruby.

G_G

Okay I changed the topic and added three new questions so if someone could help I'd like that