[2005] Creating an organizer
Well, I've came up with a clever little idea of mine to make an organizer for myself for my classes. I don't really feel like explaining how exactly it works so I've included a picture, you should get the idea.
http://www.vbforums.com/
I've added random labels of random classes as a test. When the add button is clicked, combobox1 and textbox1 become visible. In the scenario that "English" is selected from the combobox, whatever is entered into the textbox will go directly into listbox1 since listbox1 is right under English. Here's the code.
Code:
1 Dim text As String
2 text = TextBox1.Text
3 ComboBox1.Visible = True
4 TextBox1.Visible = True
5 Select Case True
6 Case ComboBox1.SelectedItem = "English"
7 If text <> "" Then
8 ListBox1.Show(text)
9 End If
10 End Select
11 End Sub
I know where the error is but I dont know what to do to fix it. What do i fix in line 8?
Re: [2005] Creating an organizer
Nevermind my previous post, i changed the listboxes to all textboxes and it works. I just want to know, how do i enter 2 separate lines of text without the previous line disappearing?
Re: [2005] Creating an organizer
Hi,
Make your textbox multine = True in the properties of your textbox.
Wkr,
sparrow1
Re: [2005] Creating an organizer
Quote:
Originally Posted by sparrow1
Hi,
Make your textbox multine = True in the properties of your textbox.
Wkr,
sparrow1
It already is. It still doesn't go to the next line. I probably have to add some coding for it as well but I have no idea what it is.
Re: [2005] Creating an organizer
When you set the textbox value, you need to keep the previous value:
Code:
TextBox1.Text = TextBox1.Text & Environment.NewLine() & "Next Value"
or more succinctly:
Code:
TextBox1.Text &= Environment.NewLine() & WebBrowser1.StatusText
Re: [2005] Creating an organizer
Thanks guys but after playing around some more, i got everything to work with listboxes which makes everything easy. One question i still have is, how do i make a new window pop up when i click the add button, and i dont mean a message box.
Re: [2005] Creating an organizer
Create a new form object. Then you can create an instance like this:
Code:
Dim f as New Form2()
f.ShowDialog()
Re: [2005] Creating an organizer
How do i create a new form object?
Re: [2005] Creating an organizer
Add a new form to your project. Right click on your project and select add->Windows Form.
Re: [2005] Creating an organizer
K got it! How do I link the forms together?
Re: [2005] Creating an organizer
Just to point out what was wrong with line 8:
ListBox.Show() simply makes the listbox visible after you use .Hide(). Also you can't put text in between the () as the command has no parameters.
I'm guessing you wanted to add "text" to the ListBox's items. In that case you would simply use ListBox1.Add(text).
Also I highly suggest you don't use the variable "text" as your program will confuse it for Me.Text which will randomly change the Title Bar text of your program. Just adding a random letter to the begging, such as "ctext" will solve that problem.
Re: [2005] Creating an organizer
Quote:
Originally Posted by knicksfan426
K got it! How do I link the forms together?
What do you mean by "link"? You can't really link forms, if you want to show one on the click of a button, just use the name of the form and .Show().
Re: [2005] Creating an organizer
I want the information that was entered into the textbox in form2 to go into the listbox that is in form1. Thats why i wanna link.
Re: [2005] Creating an organizer
Expose a property on Form2 that is public. Then after the show dialog, you can access that property and do whatever you want with it.
Re: [2005] Creating an organizer
What do u mean "Expose a property on Form2 that is public."?
Re: [2005] Creating an organizer