Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2008 I am confused... and must be stupit too.. trying to use delegate subs as callbacks..

$
0
0
I am completely confused... ok... I am not what you might call a seasoned programmer... but I can do what I gotta do when I gotta do it.. Anywho... I am really confused. I built a simple Telnet app that connects to a server and enters a user and password automatically using saved user info on another form. It works greats until I try to employ the callback (shown below) for displaying text in the terminal window, on yet another form... I can see the displayed text as long as I go through the callback subs but I cannot use my saved user and password on the options form because the triggers I am using are not visible for some reason. I can change it to the append text command which doesn't display any text but it lets the user and password statements run correctly. It seems to populate the terminal long enough to pass my user and password then deletes all of my text from the terminal so I can't see it anymore. Why does using my displayTXT subs cause my checkboxes to be invisible thereby not allowing my user and password statements to not work and why does it erase my data on the terminal when trying to use the appendtext method by itself.. ?? holy cow... makes no sense to me...

private Delegate Sub DisplayTxtCallback(ByVal dispdata As String)
Public Sub DisplayTXT(ByVal dispdata As String)
Try
CmdTerm.txtLog.AppendText(dispdata)
Catch ex As Exception

End Try
End Sub
Public Sub CallDisplayTxtCallBack(ByVal dispdata As String)
Dim cb As New DisplayTxtCallback(AddressOf DisplayTXT)
Dim args() As Object = {dispdata}
Me.Invoke(cb, args)

End Sub





-----

'If STRData <> "" Then CmdTerm.txtLog.AppendText(STRData)

If Settings_form.userchk.CheckState = CheckState.Unchecked Then
If InStr(CmdTerm.txtLog.Text, "USERNAME") > 0 Then
Dim username As String = Settings_form.user.Text
txdata = username : Me.send_data(txdata)
Settings_form.userchk.CheckState = CheckState.Checked
End If
End If
If Settings_form.pwdchk.CheckState = CheckState.Unchecked Then
If InStr(CmdTerm.txtLog.Text, "PASSWORD") > 0 Then
Dim password As String = Settings_form.pwd.Text
txdata = password : Me.send_data(txdata)
Settings_form.pwdchk.CheckState = CheckState.Checked
End If
End If


keep in mind that I have to pull data from other forms because this program does a ton of other things but I can't even get to those features because of this problem.

any help would be appreciated...

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>