troubleshooting Question

form2 - Listbox selected Item to form1- textbox 2003

Avatar of RobertoFreemano
RobertoFreemanoFlag for United Kingdom of Great Britain and Northern Ireland asked on
3 Comments1 Solution1860 ViewsLast Modified:
Hi Experts,

I have 2 parts to my project that I'm stuck on.

1) winfirm1, textbox1, contextmenu1 > I right click my textbox to access my contectmenu and select Import. it opens form2.... so far so good! :)
    winform2, listbox1, button1 > I select an item out of the list, click button1 and it should close/hide form2 and textbox1-Form1 displays Selected item... (but it don't)

Here's my code... :(

-----FORM1 ------------

   Private WithEvents f2 As Form2

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'Right Click, put text into textbox 1.      
  TextBox1.Text = "Reporting End User=" & vbCrLf & "Affected End User=" & vbCrLf & _
        "Tel=" & vbCrLf & "Site="
    End Sub

    Private Sub MenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem9.Click
'Right Click, select menuitem9 to open form 2.
        If f2 Is Nothing Then
            f2 = New Form2
        End If
        Me.TextBox1.Text = f2.ListBox1.SelectedItem
    End Sub

    Private Sub f2_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles f2.Closed
        f2 = Nothing
    End Sub
End Class
2) when I Right Click textbox1 and select menuitem9, put text into textbox 1, How can I get the cursor to appear at the end of the new text, rather than at Line 1, Top of textbox. Is this Focus for something.

Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros