Hi All.. I am creating buttons dynamically from a delimited text file and assigning text to a tooltip. This was always working just fine, but for some reason all of a sudden they stopped working. I have not done anything strange with the tooltip so I cannot explain how it happened. What seems so basic has totally stopped on me. Here is how I am creating the tooltips:
Code:
Dim myDefectFile As String
myDefectFile = Environment.CurrentDirectory & "\Defect_Files\"
Dim FILE_NAME As String = myDefectFile & "Defects.txt"
Dim data() As String
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
rawData = objReader.ReadLine()
data = Split(rawData, ",")
If data(0) = ToggleFile Then
Dim dynamicButton As New Button With {
.Location = New Point(CInt(data(2)), CInt(data(3))),
.Height = 5,
.Width = 5,
.FlatStyle = FlatStyle.Flat,
.BackColor = Color.Magenta,
.ForeColor = Color.Magenta
}
If PictureBox1.Visible = True Then
PictureBox1.Select()
Me.PictureBox1.Controls.Add(dynamicButton)
ElseIf PictureBox2.Visible = True Then
PictureBox2.Select()
Me.PictureBox2.Controls.Add(dynamicButton)
End If
Dim tip As New ToolTip
Dim myToolTipText = "SN:" & data(1) & " '" & data(6) & "'"
tip.SetToolTip(dynamicButton, myToolTipText)
TextBox1.Text = "DEFECT MAP"
End If
Loop