Click here to Skip to main content
16,020,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to write that correctly???

It says to many arguments so how am I going to write that without error???

VB
For i As Integer = 1 To 10 Step 1
          cboCategoryName.Items.Add(frmSuppliers.txtFName.Text, frmSuppliers.txtMName.Text, frmSuppliers.txtLName.Text)
      Next


It then says that Items collection cannot be modified when the DataSource property is set.

I use binding for this but when I bind it I could only display one text among the 3 textboxes how am I going to make it display the 3 text.
Posted
Updated 28-Feb-10 6:53am
v3

This is not really a good subject line for you. Your subject line should be descriptive enough to indicate what you are looking for.

It should be
VB
For i As Integer = 1 To 10
    cboCategoryName.Items.Add(String.Format("{0} {1} {2}, frmSuppliers.txtFName.Text, frmSuppliers.txtMName.Text, frmSuppliers.txtLName.Text)
   Next



Item collection takes 1 argument. If you are going to add a sentence to its item collection, you need to concat.
 
Share this answer
 
Use VS intellisense to know what paramters (type and number) needs to be added there.

Looks like, this might fit:

VB
For i As Integer = 1 To 10 Step 1
   cboCategoryName.Items.Add(frmSuppliers.txtFName.Text &  frmSuppliers.txtMName.Text & frmSuppliers.txtLName.Text)      
Next
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900