Click here to Skip to main content
16,011,358 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB or Macro? Pin
Dave Kreskowiak4-Apr-07 3:47
mveDave Kreskowiak4-Apr-07 3:47 
QuestionListview Pin
Esmo20003-Apr-07 13:20
Esmo20003-Apr-07 13:20 
AnswerRe: Listview Pin
J$3-Apr-07 15:01
J$3-Apr-07 15:01 
Questionhow to buy vb6.0 and vb.net and asp.net Pin
ciacia3-Apr-07 8:54
ciacia3-Apr-07 8:54 
AnswerRe: how to buy vb6.0 and vb.net and asp.net Pin
abbss.gaurav3-Apr-07 9:14
abbss.gaurav3-Apr-07 9:14 
GeneralRe: how to buy vb6.0 and vb.net and asp.net Pin
ciacia4-Apr-07 9:44
ciacia4-Apr-07 9:44 
AnswerRe: how to buy vb6.0 and vb.net and asp.net Pin
Dave Kreskowiak3-Apr-07 9:36
mveDave Kreskowiak3-Apr-07 9:36 
Questionbinding radio buttons with currency manager??? Pin
abbss.gaurav3-Apr-07 8:30
abbss.gaurav3-Apr-07 8:30 
the problem is that,that whenever i use navigation buttons(which i built using currency manager)..the radio button that i checked earlier during the save stage
dont show up,, rather the default button always appeared checked(which i selected during design))))please help....
how to bind radio buttons wid currency manager

here is the full code of the page that i m designing n coding




Imports System.Windows.Forms.Form
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlCommand



Public Class vendor
Inherits System.Windows.Forms.Form
Dim objsqlconn As SqlConnection
Dim objsqlcmd As SqlCommand
Dim ds As DataSet
Dim adp As SqlDataAdapter
Dim dv As DataView
Dim objcurrencymanager As CurrencyManager

Private Sub fill()
ds = New DataSet
objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
adp = New SqlDataAdapter("select * from vendordetails", objsqlconn)
adp.Fill(ds, "vendordetail")
dv = New DataView(ds.Tables("vendordetail"))

objcurrencymanager = CType(Me.BindingContext(dv), CurrencyManager)
End Sub

Private Sub bind()
TextBox1.DataBindings.Clear()
TextBox2.DataBindings.Clear()
TextBox3.DataBindings.Clear()
TextBox6.DataBindings.Clear()
TextBox7.DataBindings.Clear()
TextBox5.DataBindings.Clear()
TextBox4.DataBindings.Clear()
'Add new binding
TextBox1.DataBindings.Add("text", dv, "venname")
TextBox2.DataBindings.Add("text", dv, "id_vendor")
TextBox3.DataBindings.Add("text", dv, "phone")
TextBox6.DataBindings.Add("text", dv, "address")
TextBox7.DataBindings.Add("text", dv, "productname")
TextBox5.DataBindings.Add("text", dv, "product_id")
TextBox4.DataBindings.Add("text", dv, "totnoofpurch")
'display a status bar
StatusStrip1.Text = "Ready"

End Sub

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call fill()
Call bind()
End Sub




Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
objsqlcmd = New SqlCommand
objsqlcmd.Connection = objsqlconn

objsqlcmd.CommandText = "insert into vendordetails(venname,id_vendor,phone,address,purchasetype,productname,product_id,totnoofpurch) values(@venname,@id_vendor,@phone,@address,@purchasetype,@productname,@product_id,@totnoofpurch)"
objsqlcmd.CommandType = Data.CommandType.Text
If TextBox1.TextLength = 0 Or TextBox2.TextLength = 0 Or TextBox3.TextLength = 0 Or TextBox4.TextLength = 0 Or TextBox5.TextLength = 0 Or TextBox6.TextLength = 0 Or TextBox7.TextLength = 0 Then
MsgBox("you have not completed the form")
Else
objsqlcmd.Parameters.AddWithValue("@venname", TextBox1.Text)

objsqlcmd.Parameters.AddWithValue("@id_vendor", TextBox2.Text)

objsqlcmd.Parameters.AddWithValue("@phone", TextBox3.Text)

objsqlcmd.Parameters.AddWithValue("@address", TextBox6.Text)
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
Dim b As String
Select Case True
Case Is = RadioButton1.Checked
b = RadioButton1.Text

Case Is = RadioButton2.Checked
b = RadioButton2.Text
End Select
objsqlcmd.Parameters.AddWithValue("@purchasetype", b)
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

objsqlcmd.Parameters.AddWithValue("@productname", TextBox7.Text)


objsqlcmd.Parameters.AddWithValue("@product_id", TextBox5.Text)


objsqlcmd.Parameters.AddWithValue("@totnoofpurch", TextBox4.Text)

objsqlconn.Open()
Dim m As Integer = objsqlcmd.ExecuteNonQuery()
MsgBox(m & "no. of row inserted")
objsqlconn.Close()
End If
If TextBox1.Text = "" Then
TextBox1.Focus()
ElseIf TextBox2.Text = "" Then
TextBox2.Focus()
ElseIf TextBox3.Text = "" Then
TextBox3.Focus()
ElseIf TextBox4.Text = "" Then
TextBox4.Focus()
ElseIf TextBox5.Text = "" Then
TextBox5.Focus()
ElseIf TextBox6.Text = "" Then
TextBox6.Focus()
ElseIf TextBox7.Text = "" Then
TextBox7.Focus()
End If

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

objcurrencymanager.Position = 0

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
objcurrencymanager.Position = objcurrencymanager.Count - 1

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
objcurrencymanager.Position -= 1

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
objcurrencymanager.Position += 1

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox1.Focus()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click


End Sub
End Class



AnswerRe: binding radio buttons with currency manager??? Pin
Dave Kreskowiak3-Apr-07 9:40
mveDave Kreskowiak3-Apr-07 9:40 
QuestionCombo selection Pin
Anybloodyid3-Apr-07 8:10
Anybloodyid3-Apr-07 8:10 
AnswerRe: Combo selection Pin
Stigmurder3-Apr-07 8:44
Stigmurder3-Apr-07 8:44 
GeneralRe: Combo selection Pin
Anybloodyid3-Apr-07 10:18
Anybloodyid3-Apr-07 10:18 
Questionimage comparison Pin
amruta_muley3-Apr-07 7:32
amruta_muley3-Apr-07 7:32 
AnswerRe: image comparison Pin
Dave Kreskowiak3-Apr-07 8:17
mveDave Kreskowiak3-Apr-07 8:17 
Questiontext box control Pin
Esmo20003-Apr-07 6:53
Esmo20003-Apr-07 6:53 
AnswerRe: text box control Pin
Stigmurder3-Apr-07 8:10
Stigmurder3-Apr-07 8:10 
AnswerRe: text box control Pin
Dave Kreskowiak3-Apr-07 8:16
mveDave Kreskowiak3-Apr-07 8:16 
GeneralRe: text box control Pin
Esmo20003-Apr-07 8:25
Esmo20003-Apr-07 8:25 
GeneralRe: text box control Pin
Dave Kreskowiak3-Apr-07 10:07
mveDave Kreskowiak3-Apr-07 10:07 
QuestionOpenURL problem Pin
Huling3-Apr-07 6:11
Huling3-Apr-07 6:11 
AnswerRe: OpenURL problem Pin
Stigmurder3-Apr-07 7:33
Stigmurder3-Apr-07 7:33 
AnswerRe: OpenURL problem Pin
Dave Kreskowiak3-Apr-07 8:15
mveDave Kreskowiak3-Apr-07 8:15 
GeneralRe: OpenURL problem Pin
Huling3-Apr-07 11:03
Huling3-Apr-07 11:03 
GeneralRe: OpenURL problem Pin
Huling3-Apr-07 11:09
Huling3-Apr-07 11:09 
GeneralRe: OpenURL problem Pin
Dave Kreskowiak3-Apr-07 12:08
mveDave Kreskowiak3-Apr-07 12:08 

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.