How to insert tab in a string?

maybe it’s a silly question but I need at runtime assign the value to the initial value property of a listbox but I do not find how.

I have a listbox 2 columns and a line of code like this:

uilst_Departamentos.InitialValue = “Id”

How do I get column 1 is called id and column 2 is called description "

How am I insert a tab in the chain of string?

I’d suggest making yourself familiar with the resource already available to you that probably answer this
Lots of these kinds of questions have been answered or documented already

  1. the docs on your hard drive (next to the IDE and accessible through the Help menu)
    Search for listbox

  2. the examples right next to the IDE installed on your computer

  3. searching in this forum (in the upper right there is a search)

The FIRST thing you should do is check those and then IF you cant find the answer then ask here
Have a look and see what you can find


You can do

  1. add a row, which sets the first cell, then fill in the other cell
     listbox1.addrow "foo"
     listbox1.cell(listbox1.lastindex, 1) = "bar"
  1. add a row and several “cell” values in one call

listbox1.addrow "baz", "bop"
3) add a row with an array of values

listbox1.addrow array("123", "456")

Now why is it you want a tab in the value ?
Are you thinking of doing

listbox1.Cell(Me.LastIndex, -1) = somestring
where somestring has tabs in it ? like

  listbox1.addrow ""
  dim somestring as string = "abc" + encodings.ascii.Chr(9) + "def"
  listbox1.Cell(listbox1.LastIndex, -1) = somestring

You still have to have added the row so you might a well add the row & set the cells using the various addrow mechanisms

It looks like you want to set the Headers via InitialValue. You can set them directly.

ulist_Departamentos.Heading(0) = "ID"
ulist_Departamentos.Heading(1) = "Description"