Aralimara
New member
- Joined
- Sep 4, 2013
- Messages
- 4
- Programming Experience
- Beginner
Good evening every body :cheerful:
my post is having a reference to jmcillhenny writings here + other links
i am doing like this
(1) put 3 bindingsource controls on form
(3) binded to different dataset -> datatables ( untyped )
(3) binded the combobox column of the datagridview to binding sources
(4) at the last i have set the data property + datasource of the datagridview ( manually created the columns autogenerate columns is set to false )
now the bug says that
here are my code details
my post is having a reference to jmcillhenny writings here + other links
i am doing like this
(1) put 3 bindingsource controls on form
(3) binded to different dataset -> datatables ( untyped )
(3) binded the combobox column of the datagridview to binding sources
(4) at the last i have set the data property + datasource of the datagridview ( manually created the columns autogenerate columns is set to false )
now the bug says that
here are my code details
Private Sub BindGridCombo_Depots() Dim SQL_bind = <sql>SELECT stationregistry.StationName as CrewDepot, depot_config.DepotId FROM stationregistry INNER JOIN depot_config ON stationregistry.StationId = depot_config.StationId_Fk WHERE stationregistry.CrewBase = "Y" ; </sql> Dim S As String = SQL_bind.Value.ToString Dim Cnn896 As New MySqlConnection Dim Cmd896 As New MySqlCommand(S, Cnn896) Dim Da896 As New MySqlDataAdapter(Cmd896) Dim Ds896 As New DataSet Dim Cnm As New ConnectionManager Cnm.InitializeConnectionProperty(Cs) Dim Dt_Sepot As New DataTable With Da896 Cnm.Connect(Cnn896) .Fill(Ds896, "Container") Cnm.DisConnect(Cnn896) .Dispose() Cmd896.Dispose() End With Dt_Sepot = Ds896.Tables("Container") Ds896.Dispose() With Me.Depot_Source .DataSource = Dt_Sepot End With With Me.Dgv_CrewDetail Me.DepotCombo.DataPropertyName = "StationName" Me.DepotCombo.DisplayMember = "CrewDepot" Me.DepotCombo.ValueMember = "DepotId".ToString() Me.DepotCombo.DataSource = Depot_Source Me.DepotCombo.ValueType = GetType(String) End With End Sub
VB.NET:
Private Sub BindGridCombo_Li()
Dim SQL_bind = <sql>SELECT
lidata.LiId,lidata.LIname as CrewLiname
FROM
lidata
WHERE
lidata.Discontinue = "N"
;
</sql>
Dim S As String = SQL_bind.Value.ToString
Dim Cnn896 As New MySqlConnection
Dim Cmd896 As New MySqlCommand(S, Cnn896)
Dim Da896 As New MySqlDataAdapter(Cmd896)
Dim Ds896 As New DataSet
Dim Cnm As New ConnectionManager
Cnm.InitializeConnectionProperty(Cs)
Dim Dt_Li As New DataTable
With Da896
Cnm.Connect(Cnn896)
.Fill(Ds896, "Container")
Cnm.DisConnect(Cnn896)
.Dispose()
Cmd896.Dispose()
End With
Dt_Li = Ds896.Tables("Container")
Ds896.Dispose()
With Me.LI_source
.DataSource = Dt_Li
End With
With Me.Dgv_CrewDetail
Me.NLIcombo.DataPropertyName = "LIname"
Me.NLIcombo.DisplayMember = "CrewLiname"
Me.NLIcombo.ValueMember = "LIid".ToString()
Me.NLIcombo.DataSource = LI_source
Me.NLIcombo.ValueType = GetType(String)
End With
End Sub
VB.NET:
Private Sub Bind_FullGrid()
Dim SQL_bind = <sql>SELECT
crewregistry.CrewName,
crewregistry.Designation,
stationregistry.StationName,
crewregistry.CugNumber,
crewregistry.PerNumber,
crewregistry.CRISid,
lidata.LIname,
crewregistry.Inactive,
crewregistry.CrewId
FROM
crewregistry
INNER JOIN depot_config ON crewregistry.CrewBaseId_Fk = depot_config.DepotId
INNER JOIN stationregistry ON depot_config.StationId_Fk = stationregistry.StationId
INNER JOIN lidata ON crewregistry.NliId_Fk = lidata.LiId;
</sql>
Dim S As String = SQL_bind.Value.ToString
Dim Cnn896 As New MySqlConnection
Dim Cmd896 As New MySqlCommand(S, Cnn896)
Dim Da896 As New MySqlDataAdapter(Cmd896)
Dim Ds896 As New DataSet
Dim Cnm As New ConnectionManager
Cnm.InitializeConnectionProperty(Cs)
Dim Dt_FullGrid As New DataTable
With Da896
Cnm.Connect(Cnn896)
.Fill(Ds896, "Container")
Cnm.DisConnect(Cnn896)
.Dispose()
Cmd896.Dispose()
End With
Dt_FullGrid = Ds896.Tables("Container")
Ds896.Dispose()
With Me.S_fullGridBiner
.DataSource = Dt_FullGrid
End With
With Me.Dgv_CrewDetail
.DataSource = S_fullGridBiner
End With
End Sub
VB.NET:
Private Sub CrewBiodata_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Dgv_CrewDetail.AutoGenerateColumns = False '' Columns + DataProperty name of columns set at design time
Me.Dgv_CrewDetail.AllowUserToAddRows = True
Call BindGridCombo_Depots() ''
Call BindGridCombo_Li() '' Bind another combobox column
Call Bind_FullGrid() '' data property of the columns are set in design time
End Sub
Last edited: