VB Help

Sintoras

Shaaakaa!
Reaction score
45
I'm not sure if there's a place to post this here since theres no Programming forum but I thought someone might be able to help.

I'm a beginner with a little experience in VB. CUreently I'm using Express 2005. Now I have a problem: I made a toolstrip with a textbox which functions as a "console". You can type in different commands and it responds to them. After I added a save/ load function it stopped working, it complains about and illegal converting of the sybols "-string" to type boolean. What am I diong wrong. heres the code:
Code:
    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        If ToolStripTextBox1.Text = "-color" Or "-Color" Then
            ColorDialog1.ShowDialog()
            TextBox1.ForeColor = ColorDialog1.Color
        End If
        If ToolStripTextBox1.Text = "-Font" Or "-font" Then
            FontDialog1.ShowDialog()
            TextBox1.Font = FontDialog1.Font
        End If
    End Sub

Thanks!
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
Code:
If ToolStripTextBox1.Text = "-color" Or [B]ToolStripTextBox1.Text =[/B]  "-Color" Then

or better: just convert your TextBox1 to lowercase, which also covers "-CoLoR"
 

mase

____ ___ ____ __
Reaction score
154
Code:
If ToolStripTextBox1.Text = "-color" Or [B]ToolStripTextBox1.Text =[/B]  "-Color" Then

or better: just convert your TextBox1 to lowercase, which also covers "-CoLoR"

LCase(ToolStripTextBox.Text) = "-color"
 

Sintoras

Shaaakaa!
Reaction score
45
Thanks a lot, it worked! :)

I have another question: How could I make a list of the last opened(text)files by the programm? i mean kind of like the function Word or any other Text Program has.

The only way I can think of is, when the program opens or saves a textfile it adds the directory to a textfile. This file is read each time the programm opens up, adding the directory of the files to a list on the menu.
How would I accomplish this?
Or is there an easier way?
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
The only way I can think of is, when the program opens or saves a textfile it adds the directory to a textfile. This file is read each time the programm opens up, adding the directory of the files to a list on the menu.

Unless Visual Basic provides such a feature out-of-the-box, you have to store the list somewhere, be it in a file or in the registry.

Something like this?
 

Sintoras

Shaaakaa!
Reaction score
45
Yes, more or less. I only seem to have a simple problem, which is how to assign indexes to the menustrip items.
I think I've done it before but now I can't remember. It isn't merge index, is it?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top