locked
numbers????????? RRS feed

  • Question

  •  

    how can one print numbers on the form? what is the code for printing the numbers?

    This is Visual basic 2005 express edition.

    Friday, April 25, 2008 10:23 AM

Answers

  • Hi,

     

    As a previous user stated, you can display text on the form using number of controls. One of the most common controls you would need for displaying numbers in your program is the Label control.

     

    So drag and drop a label control and in the form_load event, add the following code:

     

    Code Snippet

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)

    ' Numbers

    Dim i As Integer = 123456789

    label1.Text = i.ToString()

    End Sub

     

     

    HTH,

    Suprotim Agarwal

     

     

    Saturday, April 26, 2008 6:08 AM

All replies

  • Hi,

     

    Could you elaborate your requirement with an example. Do you mean you want to display numbers on a form?

     

    HTH,
    Suprotim Agarwal

     

     

    Friday, April 25, 2008 11:01 AM
  • It sounds like you need to use a label control.  This is in the toolbox, and displays text (which can, of course, be numbers) on a form.  It is rectangular control, but the background is transparent, by default, so it appears as just text on the form.

     

    Set the label's Text property equal to the number you want to display.  Technically, the Text property accepts a string, rather than a numeric datatype, but the VB compiler will cast (convert) your number to a string implicitly (it'll figure it out on it's own).

    Friday, April 25, 2008 4:53 PM
  • yeah i need to display on the form.

     

    Saturday, April 26, 2008 4:06 AM
  • Hi,

     

    As a previous user stated, you can display text on the form using number of controls. One of the most common controls you would need for displaying numbers in your program is the Label control.

     

    So drag and drop a label control and in the form_load event, add the following code:

     

    Code Snippet

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)

    ' Numbers

    Dim i As Integer = 123456789

    label1.Text = i.ToString()

    End Sub

     

     

    HTH,

    Suprotim Agarwal

     

     

    Saturday, April 26, 2008 6:08 AM