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

Visual Basic

 
AnswerRe: Combobox Pin
Rupesh Kumar Swami1-Jun-07 0:20
Rupesh Kumar Swami1-Jun-07 0:20 
GeneralRe: Combobox Pin
MartyK20071-Jun-07 2:34
MartyK20071-Jun-07 2:34 
GeneralRe: Combobox Pin
Dave Kreskowiak1-Jun-07 3:45
mveDave Kreskowiak1-Jun-07 3:45 
GeneralRe: Combobox Pin
MartyK20071-Jun-07 3:51
MartyK20071-Jun-07 3:51 
GeneralRe: Combobox Pin
eagertolearn3-Jun-07 17:29
eagertolearn3-Jun-07 17:29 
GeneralRe: Combobox Pin
Rupesh Kumar Swami3-Jun-07 23:46
Rupesh Kumar Swami3-Jun-07 23:46 
GeneralRe: Combobox Pin
eagertolearn4-Jun-07 16:07
eagertolearn4-Jun-07 16:07 
QuestionNOT ABLE TO SET THE DATASOURCE FOR THE COMBOBOX Pin
MissionSuccess1-Jun-07 0:03
MissionSuccess1-Jun-07 0:03 
respected Gurus
i m making a windows application in vb.net.
here i m trying to bind a combobox from dataset.
but whenever i m trying to set the datasource property of my combobox,it jumps to the selectedindexchanged event for the combo box.

my code is as follows:-----------------

code to populate the combobox:---------------

Public Sub populateWebtype()
Try
cnSQL = New SqlConnection(ConnectionString)
Dim strSQL As String = "select webcode,webdesc from webmast"
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
cmSQL.CommandType = CommandType.Text
adpSQL = New SqlDataAdapter(cmSQL)
ds = New DataSet
adpSQL.Fill(ds)

Dim dr As DataRow
dr = ds.Tables(0).NewRow
'dr(valuemember) = ""
dr("webdesc") = "--Select--"
ds.Tables(0).Rows.InsertAt(dr, 0)


Me.cmbWebType.DataSource = ds.Tables(0).DefaultView 'AFTER THIS LINEJUMPS TO THE SELECTEDINDEXCHANGED

Me.cmbWebType.DisplayMember = "webdesc"
Me.cmbWebType.ValueMember = "webcode"
Me.cmbWebType.SelectedIndex = 0
cnSQL.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub


selectedindexchangedevent of combobox:-----------

Private Sub cmbWebType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbWebType.SelectedIndexChanged
Try
Dim webcode As Integer
webcode = cmbWebType.SelectedValue
strSQL = "select rmdesc as RawMaterial,Micron,Density,Gsm,Quantity as Norm from webnorm,webmast,rmmast where delete_flag <> 'Y' and webnorm.webcode = webmast.webcode and webnorm.rmcode = rmmast.rmcode And webnorm.webcode = " & webcode
cnSQL = New SqlConnection(ConnectionString)
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
cmSQL.CommandType = CommandType.Text
adpSQL = New SqlDataAdapter(cmSQL)
ds = New DataSet
adpSQL.Fill(ds)
DataGrid1.DataSource = ds.Tables(0).DefaultView

strSQL = "select distinct total_micron,total_gsm,total_quantity,sqmperkg from webnorm where delete_flag <> 'Y'And webnorm.webcode = " & webcode
cmSQL = New SqlCommand(strSQL, cnSQL)
Dim readSQL As SqlDataReader
readSQL = cmSQL.ExecuteReader
While readSQL.Read
If Not IsDBNull(readSQL("total_micron")) Then
txtTotalMicron.Text = readSQL("total_micron")
End If
If Not IsDBNull(readSQL("total_gsm")) Then
txtTotalGsm.Text = readSQL("total_gsm")
End If
If Not IsDBNull(readSQL("total_quantity")) Then
txtTotalQuantity.Text = readSQL("total_quantity")
End If
If Not IsDBNull(readSQL("sqmperkg")) Then
txtSqmPerKg.Text = readSQL("sqmperkg")
End If
End While
cnSQL.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
AnswerRe: NOT ABLE TO SET THE DATASOURCE FOR THE COMBOBOX Pin
Christian Graus1-Jun-07 0:20
protectorChristian Graus1-Jun-07 0:20 
GeneralRe: NOT ABLE TO SET THE DATASOURCE FOR THE COMBOBOX Pin
MissionSuccess1-Jun-07 2:07
MissionSuccess1-Jun-07 2:07 
GeneralRe: NOT ABLE TO SET THE DATASOURCE FOR THE COMBOBOX Pin
Dave Kreskowiak1-Jun-07 3:44
mveDave Kreskowiak1-Jun-07 3:44 
Questionworking with Strings Pin
Raheem MA31-May-07 22:56
Raheem MA31-May-07 22:56 
AnswerRe: working with Strings Pin
JF201531-May-07 23:16
JF201531-May-07 23:16 
GeneralRe: working with Strings Pin
Raheem MA31-May-07 23:31
Raheem MA31-May-07 23:31 
AnswerRe: working with Strings Pin
Christian Graus1-Jun-07 0:24
protectorChristian Graus1-Jun-07 0:24 
QuestionReport Pin
vengaqua31-May-07 19:34
vengaqua31-May-07 19:34 
AnswerRe: Report Pin
Sonia Gupta31-May-07 19:49
Sonia Gupta31-May-07 19:49 
QuestionIs VB.net platform independent or not? Pin
mnarayana331-May-07 19:33
mnarayana331-May-07 19:33 
AnswerRe: Is VB.net platform independent or not? Pin
Sonia Gupta31-May-07 19:47
Sonia Gupta31-May-07 19:47 
GeneralRe: Is VB.net platform independent or not? Pin
Christian Graus31-May-07 20:05
protectorChristian Graus31-May-07 20:05 
QuestionRe: Is VB.net platform independent or not? Pin
Sonia Gupta31-May-07 20:09
Sonia Gupta31-May-07 20:09 
AnswerRe: Is VB.net platform independent or not? Pin
Christian Graus31-May-07 20:14
protectorChristian Graus31-May-07 20:14 
GeneralRe: Is VB.net platform independent or not? Pin
Guffa31-May-07 21:49
Guffa31-May-07 21:49 
AnswerRe: Is VB.net platform independent or not? Pin
Christian Graus31-May-07 20:04
protectorChristian Graus31-May-07 20:04 
AnswerRe: Is VB.net platform independent or not? Pin
Steven J Jowett31-May-07 23:45
Steven J Jowett31-May-07 23:45 

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.