#1
  1. No Profile Picture
    Dim Brendan as Noob
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    475
    Rep Power
    506

    VB.NET 3.5 Request Headers and label(num).text Pragmatically


    I have two questions:

    1) I am using a function for getting and posting data. I am wondering if there is any difference between:

    Code:
    request.Headers.Add(HttpRequestHeader.Accept, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    and
    Code:
    request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    2) Is there any way to change a number pragmatically for the name of a label?

    For instance if I have label0.text and label1.text and label2.text etc I would like to use a for loop to cycle through them. Is there any way to do this?

    Thank you in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    44
    I cannot answer question 1 because I use direct Winsock calls for Internet access, but as far as the second question is concerned, you should be able to access the controls by number instead of by name (assuming you mean programatically instead of pragmatically):
    Code:
    Private Sub Command1_Click()
        Dim N As Integer
        For N = 0 To Controls.Count - 1
            If TypeOf Controls(N) Is TextBox Then
                Debug.Print Controls(N).Name
            End If
        Next N
    End Sub
    I also assumed that you meant Textbox controls instead of Label controls, since Label controls do not have a Text property.

    J.A. Coutts

IMN logo majestic logo threadwatch logo seochat tools logo