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
indy500fanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YZlatCommented:
try this;

  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...
dim temp as string=txtCamIP.Text
            If chkActivateCameraTcpipListener.Checked = True Then

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

                FinishLynxTCPIP.FinishLynxSessionConnect(FinishLynxCameraIP, FinishLynxCameraPort)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YZlatCommented:
also try using Watch window in the debug mode to monitor the changes in the textbox value
0
g_johnsonCommented:
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?
0
indy500fanAuthor Commented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.