Results 1 to 7 of 7

Thread: Listbox mouse XZ not working properly

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Posts
    434

    Listbox mouse XZ not working properly

    Hello

    I upgraded a VB6 app to .net.

    I'm in the process of removing all of the VB namespace stuff to get the app to pure .net.

    I have a listbox that allows you to select multiple lines. In the mouse up event the upgrade wizard created these lines:
    Code:
    Dim Button As Short = eventArgs.Button \ &H100000
    Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
    Dim x As Single = VB6.PixelsToTwipsX(eventArgs.X)
    Dim y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
    If I change it to this:
    Code:
    Dim Button As Short = eventArgs.Button \ &H100000
    Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
    Dim x As Single = eventArgs.X
    Dim y As Single = eventArgs.Y
    to remove the VB6 reference the mouse coordinates are not right and it messes everything up.

    I've looked around to see of I can find some setting to fix it but I can't see anything that looks like it will help.

    Any Ideas?

    Thanks

    David

    Ps: 1 pixel = 15 Twips

  2. #2
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Listbox mouse XZ not working properly

    Quote Originally Posted by David RH
    I'm in the process of removing all of the VB namespace stuff to get the app to pure .net.
    Get rid of those twips! , what are you trying to do with the mouse coordinates that's not working?

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Posts
    434

    Re: Listbox mouse XZ not working properly

    I'm trying

    I already converted all of the other T to P stuff (control position coordinates and such) and that went well.

    The mouse doesn't return the correct coordinates so the wrong item gets selected.

  4. #4
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: Listbox mouse XZ not working properly

    I recommend coding from scratch instead of using .net's migrator or you may end up with quite a pile of ****

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Listbox mouse XZ not working properly

    .NET code works in pixels all the time. If you change the code that uses those 'x' and 'y' variables to use pixels too then there's no issue.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Posts
    434

    Re: Listbox mouse XZ not working properly

    Now I'm really flummoxed.

    The problem started when I messed with those 2 lines. But I did a search and they don't appear to be used anywhere. So I put them back to their previous state and the problem didn't go away. ???

    The line of code that it chokes on is:
    Code:
    If lstSortedLines.SelectedIndex < 7 Then
    The error code is:

    An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll

    Additional information: Index was outside the bounds of the array.

    Ideas?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Posts
    434

    Re: Listbox mouse XZ not working properly

    Say is it possible to have a multi-line item in a listbox?

    Example: each list item has a 3 line paragraph of text completely visable.

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