[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

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
0
indy500fan
Asked:
indy500fan
  • 2
1 Solution
 
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
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now