Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

ListBox Items As Header Text in a Datagridview Columns

Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) ToutountzoglouFlag for Greece asked on
Visual Basic.NET
9 Comments1 Solution1166 ViewsLast Modified:
I have a databound ListBox .I need to pass the items as header text in my datagridView Columns.
i use the follwing code

Dim drv as datarowview =Ctype(me.Listbox1.SelectedItem,Datarowview)
dim SelTex as String=drv.Item("ColumnItems")
Dim TNumber as integer =Me.Listbox.Items.Count
   'For the Datagridview i set the visibility of the Desired Columns to true'
    
     For i as integer =3 to (3+TNumber)-1 
         Me.Datagridview1.Columns.Item(i).Visible=true
         Me.Datagridview1.Columns.item(i).HeaderText=SelText     'And Here Is My Problem I got Only the First item .I know that i have to loop through the lisbox items but......'
      next
ASKER CERTIFIED SOLUTION
Avatar of Shahan Ayyub
Shahan AyyubFlag of Pakistan imageStaff Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers