System.Windows.Forms.TextBox,%20 is being added before each substitution

Hello,
I am trying to "make" a web address from some textboxes from my form...

I need to get this:

http://api.local.yahoo.com/MapsService/V1/mapImage appid=SSVRT_KN1123&city=redmond&state=washington&lvl=10

but I am getting this:

http://api.local.yahoo.com/MapsService/V1/mapImage appid=SSVRT_KN1123&city=System.Windows.Forms.TextBox,%20Text:%20redmond&state=System.Windows.Forms.TextBox,%20Text:%20washington&lvl=10


This is my code:
--------------------------CODE------------------------
Public Class Form1

    Public cityLoc As String
    Public stateLoc As String
   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        cityLoc = city.ToString
        stateLoc = state.ToString
               Process.Start("http://api.local.yahoo.com/MapsService/V1/mapImage appid=SSVRT_KN1123&city=" + cityLoc + "&state=" + stateLoc + "&lvl=10")

    End Sub
End Class

---------------------END CODE---------------------------

so apparently, I have two text boxes named:
city
state

and variables cityLoc and stateLoc are being defined by the string values of the textboxes...
but for some weird reason, instead of the pure string values being substituted for the Process.start(), it's adding:

System.Windows.Forms.TextBox,%20

before each string entered into the textbox...

I don't know why, times before this, it was perfect,
so can anyone tell me what's wrong with this code

Thank You!
Keehun Nam



Answer this question

System.Windows.Forms.TextBox,%20 is being added before each substitution

  • Madhu Ponduru

    Sorry, I am half asleep. Instead of ToString, use the Text property.



  • www.ilkon.com

    ToString doesn't need () in VB

    Why have the strings as member variables I would just put city.ToString() and state.ToString() direct into the Process.Start command.



  • System.Windows.Forms.TextBox,%20 is being added before each substitution