Results 1 to 5 of 5

Thread: ** RESOLVED ** Gridding

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved ** RESOLVED ** Gridding

    I have decided to make the jump to VB.NET (2005). I looked (took a class) at C#.NET and decided that the gains aren't enough to make me jump that far.

    So, I took my simplest VB6 project and ran it through the upgrade wizard. I am trying to clean up the collateral damage now. I see that the MSFlexGrid is no more. Unfory=unately, I use it a lot in my apps.

    I replaced it with a DatGridView (for multiple columns). Is this the proper substitution? Or would a ListView work better?

    If so, I need to find the equivalent command to "redraw". I used it to prevent the grid from flickering while I filled the rows.

    Speaking of which, it doesn't seem to like commands like:

    grid1.row = 2
    grid1.col = 2

    The only books I have so far are "upgrading books", not reference manuals. Haven't been able to get to the bookstore (30 miles away) yet.

    I am trying to figure it out on my own, but I could use a quick bump on this one.
    Last edited by Pasvorto; Apr 11th, 2006 at 11:27 AM.

  2. #2
    Lively Member
    Join Date
    Apr 2005
    Posts
    91

    Re: Gridding

    Hi,
    Yes you can use a listview, to stop flickering use

    VB Code:
    1. me.listview1.beginupdate()
    2.      'update code here
    3. me.listview1.endupdate()

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Gridding

    I am making headway. I decided to go with the listview. I added this code:
    VB Code:
    1. ListView2.Items(0).SubItems.Add(CSng(txtUnits.Text) * 30.48)
    2.         ListView2.Items(0).SubItems.Add("Centimeters")
    3.         ListView2.Items(1).SubItems.Add(CSng(txtUnits.Text) * 0.3048)
    4.         ListView2.Items(1).SubItems.Add("Meters")
    5.         ListView2.Items(2).SubItems.Add(CSng(txtUnits.Text) / 3)
    6.         ListView2.Items(2).SubItems.Add("Yards")
    7.         ListView2.Items(3).SubItems.Add(CSng(txtUnits.Text) * 12)
    8.         ListView2.Items(3).SubItems.Add("Inches")

    Now I get the error:
    "An error occurred: [5] InvalidArgument=Value of '0' is not valid for 'index'. Paramter name: index - Source: System.Windows.Forms"

    Is this saying that I have to start the "row numbering" at 1?

  4. #4

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Gridding

    I changed the index to start at (1). Got the same error, however substitute '1' for '0'.

    It is a 2 column list. I just need to populate the columns.

  5. #5

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Re: Gridding

    Got it!!

    VB Code:
    1. Me.ListView2.BeginUpdate()
    2.         ListView2.Items.Add(CSng(txtUnits.Text) * 30.48)
    3.         ListView2.Items(0).SubItems.Add("Centimeters")
    4.         ListView2.Items.Add(CSng(txtUnits.Text) * 0.3048)
    5.         ListView2.Items(1).SubItems.Add("Meters")
    6.         ListView2.Items.Add(CSng(txtUnits.Text) / 3)
    7.         ListView2.Items(2).SubItems.Add("Yards")
    8.         ListView2.Items.Add(CSng(txtUnits.Text) * 12)
    9.         ListView2.Items(3).SubItems.Add("Inches")
    10.         Me.ListView2.EndUpdate()

    Thanks for all the help. Time to go looking for manuals.

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