Printing name and index of a control
Hi,
I wanted to print the name of a control (like if it's a text box --> textbox, not the name I've given to that) and the index in form of that control (it's prefered if there are more than one of that control, index amongst them.). It's something I came up while watching Joe Hummel's webcasts. The code I wrote is here, unfortunately it doesn't work:
------------------------------------------------
Private Sub Common_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim txt As TextBox
txt = sender
Dim printstr As String
Globals.Changed = True
printstr = "New text of " & TypeOf(txt).ToString & "(" & txt.Parent.Controls.IndexOf(txt).ToString & "): " & txt.Text
System.Diagnostics.Debug.WriteLine(printstr)
End Sub
------------------------------------------------
Any help?
|