We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

indy500fan
indy500fan asked
on
Medium Priority
191 Views
Last Modified: 2012-05-05
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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
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)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT

Commented:
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?

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.