Click here to Skip to main content
15,912,329 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: String to Datagridviewcell Conversion Pin
Dave Kreskowiak13-Dec-07 1:48
mveDave Kreskowiak13-Dec-07 1:48 
GeneralRe: String to Datagridviewcell Conversion Pin
VB 8.014-Dec-07 0:42
VB 8.014-Dec-07 0:42 
GeneralRe: String to Datagridviewcell Conversion Pin
Dave Kreskowiak14-Dec-07 0:48
mveDave Kreskowiak14-Dec-07 0:48 
GeneralRe: String to Datagridviewcell Conversion Pin
VB 8.016-Dec-07 21:43
VB 8.016-Dec-07 21:43 
GeneralRe: String to Datagridviewcell Conversion Pin
Dave Kreskowiak17-Dec-07 1:41
mveDave Kreskowiak17-Dec-07 1:41 
QuestionHow to Update Binded Combobox value ? Pin
rashadaliarshad12-Dec-07 23:29
rashadaliarshad12-Dec-07 23:29 
GeneralRe: How to Update Binded Combobox value ? Pin
Dave Kreskowiak13-Dec-07 4:15
mveDave Kreskowiak13-Dec-07 4:15 
AnswerRe: How to Update Binded Combobox value ? Pin
rashadaliarshad13-Dec-07 20:57
rashadaliarshad13-Dec-07 20:57 
. .
.
you need a second BindingSource and set it's DataSource and DataMember properties to the table that's going to supply the ID's and Text for the ComboBox to show.

I wrote code manually to get get ID and Name fields from database. here is the code.

Private Sub LoadSuppliers()<br />
        <br />
        m_CommandSupplier = New SqlCommand<br />
        m_CommandSupplier.CommandText = "Select SupplierId, SupplierName from Suppliers"<br />
        <br />
        Try<br />
            m_DaSupplier = New SqlDataAdapter<br />
            m_DaSupplier.SelectCommand = m_CommandSupplier<br />
<br />
            // connection has already been created in seprate Sub-Routine            m_DaSupplier.SelectCommand.Connection = m_ConnectionSupplier<br />
<br />
            m_DsSupplier = New DataSet()<br />
            m_DaSupplier.Fill(m_DsSupplier)<br />
<br />
        Catch ex As Exception<br />
<br />
            MsgBox(ex.ToString, MsgBoxStyle.Critical, " Get Suppliers")<br />
<br />
        End Try<br />
<br />
        m_DsSupplier.Tables(0).TableName = "Suppliers"<br />
<br />
1 - it's DisplayMember to the field that's supplying the Text the user gets to see in the Combo and set the ValueMember property to the field that's supplying the ID's for those text items.<br />
<br />
2 - create a new Binding object and add it to the DataBindings property of the ComboBox<br />
<br />
Both these task are accomplished in the following code, SupplierNAme is set as Display MEmber , while the SupplierID is set a value member.<br />
<br />
        With SupplierIDComboBox<br />
            .DataSource = mDsSupplier.Tables("Suppliers")<br />
            .DisplayMember = "SupplierName"<br />
            .ValueMember = "SupplierId"<br />
            .DataBindings.Clear()<br />
            .DataBindings.Add("SelectedValue", PurchaseOrderDetailsDataSet.PurchaseOrders, "SupplierId")<br />
<br />
        End With<br />
<br />
<br />
    End Sub


the table that's supplying the data for the ComboBox. There's normally a one-to-many relationship between these two tables.

The Table that supply the value for both tables is actually a Binding Source with a binding navigator to move back and forth. All these were automatically drawn when i dragged the 'PurchaseOrder' Table from Datasources window.

Note: 'PurchaseOrder' table was set to draw control in 'DETAILS mode' while "PurchaseOrderDetails" table was set to 'DAtagridview mode'.

Now when i run the program, the value for PurchaseOrder and PurchaseOrderDetails tables in both Details and datagrid goes fine.

But when i click 'MOVE NEXT RECORD' button from BINDING NAVIGATOR. All the values in Textboxes and DATAGRIDVIEW changes accurately. But the values in comboboxes like SUPPLIER ID does not change. and it stick to the value that was loaded with FIRST RECORD. What should i do? Sniff | :^)

:- Rashid Ali -:

GeneralRAS - Creation of a VPN connnection Pin
Xavier Laurent12-Dec-07 23:24
Xavier Laurent12-Dec-07 23:24 
GeneralRe: RAS - Creation of a VPN connnection Pin
Dave Kreskowiak13-Dec-07 7:20
mveDave Kreskowiak13-Dec-07 7:20 
Generalsub report could not be shown Pin
di3.ny2812-Dec-07 21:38
di3.ny2812-Dec-07 21:38 
GeneralRe: sub report could not be shown Pin
Dave Kreskowiak13-Dec-07 7:22
mveDave Kreskowiak13-Dec-07 7:22 
Questionhow to hide the Start Button in Vista using VB.NET2005 Pin
funakawa12-Dec-07 18:29
funakawa12-Dec-07 18:29 
GeneralRe: how to hide the Start Button in Vista using VB.NET2005 Pin
Michael Sync12-Dec-07 22:24
Michael Sync12-Dec-07 22:24 
GeneralRe: how to hide the Start Button in Vista using VB.NET2005 Pin
funakawa16-Dec-07 16:11
funakawa16-Dec-07 16:11 
QuestionHelp on dymanic installation Pin
highjo12-Dec-07 12:28
highjo12-Dec-07 12:28 
GeneralRe: Help on dymanic installation Pin
Michael Sync12-Dec-07 22:18
Michael Sync12-Dec-07 22:18 
GeneralRe: Help on dymanic installation Pin
highjo13-Dec-07 8:49
highjo13-Dec-07 8:49 
GeneralTO START Pin
Kahuna12-Dec-07 12:14
Kahuna12-Dec-07 12:14 
GeneralRe: TO START PinPopular
Christian Graus12-Dec-07 12:31
protectorChristian Graus12-Dec-07 12:31 
Questionacessing MDI form status bar from other forms/public methods Pin
Adnan Siddiqi12-Dec-07 9:13
Adnan Siddiqi12-Dec-07 9:13 
GeneralRe: acessing MDI form status bar from other forms/public methods Pin
Dave Kreskowiak12-Dec-07 10:19
mveDave Kreskowiak12-Dec-07 10:19 
Generalmoving a Form With No Border Pin
Orlando_Herrera12-Dec-07 8:01
Orlando_Herrera12-Dec-07 8:01 
GeneralRe: moving a Form With No Border Pin
Christian Graus12-Dec-07 8:56
protectorChristian Graus12-Dec-07 8:56 
GeneralRe: moving a Form With No Border Pin
Kristian Sixhøj12-Dec-07 9:05
Kristian Sixhøj12-Dec-07 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.