Hello Everybody
prop lame
i am making a access sql helper

and for writing the insert this code

Dim i As Integer
        TextBox6.Text &= "Insert Into " & ComboBox2.Text & " ("
        For i = 0 To ListBox1.Items.Count - 1
            TextBox6.Text &= ListBox1.Items.Item(i).ToString() & ","
        Next
        TextBox6.Text &= ")"

it works very good

example of the code

Insert Into Contacts (Address,ContactID,FirstName,LastName,)

,

i want to remove this access comma

Try:

Dim i As Integer
TextBox6.Text &= "Insert Into " & ComboBox2.Text & " ("
For i = 0 To ListBox1.Items.Count - 1
TextBox6.Text &= ListBox1.Items.Item(i).ToString() & ","
Next
TextBox6.Text.Remove(TextBox6.Text.Length - 1, 1)
TextBox6.Text &= ")"

That one line should remove the very last character, in your case ",".
I did not test this code, so it may not be PERFECT, but it should work.

commented: thanks +1

or use

if i < ListBox1.Items.Count - 1 then textbox6.text &= ","

to insert the comma (,) character.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.