Results 1 to 6 of 6

Thread: Formatting output

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Formatting output

    I'm tryin to get the data from grid(row,col) to display in the listbox horizontally. I can't seem to get it to work. Can anybody help??

    Dim grid(25, 25) as string

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
    Dim row, col, x, y As Integer
    Dim len As Integer
    len = txtIn.Text.Length
    y = 0
    row = 0
    row += 1
    For col = 1 To len
    grid(row, col) = txtIn.Text.Substring(y, 1)
    x += 1
    y += 1

    ListBox1.Items.Add(grid(row, col))
    Next
    txtIn.Text = ""

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,454

    Re: Formatting output

    ListBoxes are for single column lists and they display vertically. ListBoxes are not for tabular data. To make a ListBox display tabular data or in some way other than for what it was intended is possible but requires all sorts of kludgy hacks that are pointless anyway because you can simply a ListView, DataGrid or DataGridView instead. You don't put a screw in with a hammer or a nail with a screwdriver. Use the right tool for the job.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Formatting output

    Thanks man I'm just learnin VB and the book I have really sucks.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Formatting output

    I used a listview is there anyway to decrease the size of the spacing without a smaller font.

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,454

    Re: Formatting output

    You can set the Width of the columns if that's what you're talking about.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Re: Formatting output

    i got it.
    is there some way to drop down a row in the listview with code.
    somewhat like listview.items.add(" ") but down a row instead of a space over

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width