Results 1 to 16 of 16

Thread: [2005] Creating an organizer

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    [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.



    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?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    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?

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Creating an organizer

    Hi,

    Make your textbox multine = True in the properties of your textbox.

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    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.

  5. #5
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    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.

  7. #7
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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()

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    Re: [2005] Creating an organizer

    How do i create a new form object?

  9. #9
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Creating an organizer

    Add a new form to your project. Right click on your project and select add->Windows Form.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    Re: [2005] Creating an organizer

    K got it! How do I link the forms together?

  11. #11
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  12. #12
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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().
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    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.

  14. #14
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    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.

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Feb 2009
    Posts
    82

    Re: [2005] Creating an organizer

    What do u mean "Expose a property on Form2 that is public."?

  16. #16
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Creating an organizer

    This link shows you the basics of properties:

    http://msdn.microsoft.com/en-us/libr...classes_topic3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width