Results 1 to 5 of 5

Thread: Second Tab in a MenuItem displayed as a square.

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Second Tab in a MenuItem displayed as a square.

    I'm dynamically creating menu items from a few database columns. I want to format the line of text so it looks clean, so I tried separating with tabs. Problem is, only the first tab gets displayed as a tab, the second and third will get displayed as a square.

    Any ideas? Code snippet:

    VB Code:
    1. cmd.CommandText = "SELECT Agency, Call, Violation FROM vActiveCalls"
    2.                 dr = cmd.ExecuteReader
    3.                 While dr.Read
    4.                     mi.MenuItems.Add(dr.GetString(0) & Chr(9) & dr.GetString(1) & Chr(9) & dr.GetString(2))
    5.                 End While

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try using ControlChars.Tab or " " instead of Chr(9) and see if that works.

  3. #3

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    ControlChars.Tab, Chr(9) and vbTab all produce the same (bad) result.

    A space (" ") does work ok, but I was hoping for column-type formatting when the column text is of varying length.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Actually I tried to put 5 spaces but HTML ruined it I guess. To create a column effect you can could try using the Pad methods. If you use a fixed width font like New Courier then it works well other wise it just gets you sort of there. Here is an example:
    VB Code:
    1. Dim col1() As String = {"Ed", "Mike", "Cookie"}
    2.         Dim col2() As String = {"Developer", "Hardware Tech", "Vice President"}
    3.         Dim col3() As String = {"$43,000", "$35,000", "$85,000"}
    4.         Dim collength As Integer = 18
    5.         For x As Integer = 0 To 2
    6.             mnuTest.MenuItems.Add(col1(x).PadRight(collength) & col2(x).PadRight(collength) & col3(x).PadRight(collength))
    7.         Next

    Actually after testing it might not be what you want.
    Last edited by Edneeis; Nov 7th, 2003 at 02:21 PM.

  5. #5

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    I'll give that a try, thanks. This is a reponse I got from a microsoft news group:

    > In menu items the tab character has a special semantic. It's used to
    > separate the accelerator from the caption. You cannot use more than one
    > tab. Alternatively you may want to create your own "ownerdrawn" menu:
    >
    > <http://www.codeproject.net/vb/net/vsnetstylemenusvb.asp>
    > <http://www.codeproject.net/vb/net/iconsmenu.asp>
    >

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