Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Columns in a string in VB.NET

Columns in a string in VB.NET

Scheduled Pinned Locked Moved Visual Basic
csharptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chaos Machine
    wrote on last edited by
    #1

    Hello everybody. I am trying to create a string which will have spaces in between words that create "columns". In vb6 i used to use tab(). EG string 3 = string1 & tab(5) & string2 and i would have the following: areaName PostCode Suburb test 125 the suburb test2 225 another suburb so when i use the print command to have it in columns. How to i do that in vb.net. Thank you in advance. Still trying to find the way

    O 1 Reply Last reply
    0
    • C Chaos Machine

      Hello everybody. I am trying to create a string which will have spaces in between words that create "columns". In vb6 i used to use tab(). EG string 3 = string1 & tab(5) & string2 and i would have the following: areaName PostCode Suburb test 125 the suburb test2 225 another suburb so when i use the print command to have it in columns. How to i do that in vb.net. Thank you in advance. Still trying to find the way

      O Offline
      O Offline
      OICU812
      wrote on last edited by
      #2

      I just had that same problem. Here is an example: ' Draw all font names on form Dim gr As Graphics = Me.CreateGraphics gr.Clear(Color.White) ' Prepare a message with tabs and carriage returns. Dim msg As String = String.Format("{0}Column 1{0}Column 2{0}Column 3{1}" _ & "Row 1{0}Cell (1,1){0}Cell (1,2){0}Cell (1,3){1}" _ & "Row 2{0}Cell (2,1){0}Cell (2,2){0}Cell (2,3){1}", _ ControlChars.Tab, ControlChars.CrLf) Dim fnt As New Font("Arial", 12) Dim strFormat As New StringFormat() ' Set the tab stops. Dim tabStops() As Single = {80, 140, 200} strFormat.SetTabStops(0, tabStops) ' Draw the text with specified tab stops. gr.DrawString(msg, fnt, Brushes.Black, 20, 20, strFormat) fnt.Dispose() gr.Dispose() Hope that hels you!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups