Concatenate field values

Discussion in 'ASP .Net Web Controls' started by TJHerman, Jun 13, 2006.

  1. TJHerman

    TJHerman Guest

    I'm sure this is ridiculously simple, but I'm new to this.

    I'm trying to combine the values of three variables dimensioned as labels
    into a single label variable.

    My statement reads like this:

    sName = autoNum & " - " & projnum & " - " & lblPropTitle

    The error statement says:
    "Operator '&' is not defined for types 'System.Web.UI.WebControls.Label' and
    'String'."

    Can someone tell me what I'm doing wrong?
     
    TJHerman, Jun 13, 2006
    #1
    1. Advertising

  2. TJHerman

    Guest

    hehe, welcome to asp.net =) i'm assuming you're using vb.net and trying
    to concatenate the text that the label contains right? lblPropTitle is
    (probably) a Label, so you need to use lblPropTitle.Text to get at the
    input text ... ditto for the other two

    assuming they are all labels, you want:
    sName = autoNum.Text & " - " & projnum.Text & " - " & lblPropTitle.Text

    let us know if that works!
    TJHerman wrote:
    > I'm sure this is ridiculously simple, but I'm new to this.
    >
    > I'm trying to combine the values of three variables dimensioned as labels
    > into a single label variable.
    >
    > My statement reads like this:
    >
    > sName = autoNum & " - " & projnum & " - " & lblPropTitle
    >
    > The error statement says:
    > "Operator '&' is not defined for types 'System.Web.UI.WebControls.Label' and
    > 'String'."
    >
    > Can someone tell me what I'm doing wrong?
     
    , Jun 13, 2006
    #2
    1. Advertising

  3. TJHerman

    TJHerman Guest

    Thanks so much!

    "" wrote:

    > hehe, welcome to asp.net =) i'm assuming you're using vb.net and trying
    > to concatenate the text that the label contains right? lblPropTitle is
    > (probably) a Label, so you need to use lblPropTitle.Text to get at the
    > input text ... ditto for the other two
    >
    > assuming they are all labels, you want:
    > sName = autoNum.Text & " - " & projnum.Text & " - " & lblPropTitle.Text
    >
    > let us know if that works!
    > TJHerman wrote:
    > > I'm sure this is ridiculously simple, but I'm new to this.
    > >
    > > I'm trying to combine the values of three variables dimensioned as labels
    > > into a single label variable.
    > >
    > > My statement reads like this:
    > >
    > > sName = autoNum & " - " & projnum & " - " & lblPropTitle
    > >
    > > The error statement says:
    > > "Operator '&' is not defined for types 'System.Web.UI.WebControls.Label' and
    > > 'String'."
    > >
    > > Can someone tell me what I'm doing wrong?

    >
    >
     
    TJHerman, Jun 13, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. priya
    Replies:
    30
    Views:
    30,645
    Jacques Labuschagne
    May 27, 2005
  2. Replies:
    2
    Views:
    7,692
  3. NotGiven
    Replies:
    7
    Views:
    360
    Dr John Stockton
    Jul 24, 2003
  4. Sound
    Replies:
    2
    Views:
    454
    Randy Webb
    Sep 28, 2006
  5. Carlos

    Concatenate/De-Concatenate

    Carlos, Oct 12, 2012, in forum: VHDL
    Replies:
    10
    Views:
    893
Loading...

Share This Page