Link to home
Create AccountLog in
Avatar of indy500fan
indy500fan

asked on

cannot find why string is getting cleared from .text of a textbox

Friends,

I cannot figure out why, but the .text of a textbox is getting cleared.

Here is my code:

    Private Sub chkActivateCameraTcpipListener_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkActivateCameraTcpipListener.CheckedChanged

        Dim FinishLynxCameraIP As String
        Dim FinishLynxCameraPort As Integer

        Try
            MessageBox.Show(txtCamIP.Text & " " & txtCamPort.Text) '<--- I threw this in to confirm that the .text actually contained a string, and it does, until...

            If chkActivateCameraTcpipListener.Checked = True Then

                FinishLynxCameraIP = txtCamIP.Text '<----At this point .Text = "" and...
                FinishLynxCameraPort = CType(txtCamPort.Text, Integer) '<------ .Text = 0

                FinishLynxTCPIP.FinishLynxSessionConnect(FinishLynxCameraIP, FinishLynxCameraPort)

Any idea why it would get cleared after the If statement???

Thanks in advance!

Eric
ASKER CERTIFIED SOLUTION
Avatar of YZlat
YZlat
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
also try using Watch window in the debug mode to monitor the changes in the textbox value
well, ain't this a mystery!  Have you stepped through your code and checked the value of txtCamIP.text at the "if" statement and immediately after the "if" statement executes?
Avatar of indy500fan
indy500fan

ASKER

YZlat,

I tried your suggestion, and it worked.  I can't figure out why, but after the Check, the .Text values are cleared.

Thanks!

Eric