| | |
Shop Program help...
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
Hi, I have a project that I’ve been trying to do for months and months on my own, but it has got to the point where I can’t carry on because I’m so stuck, and all the tuts I try to follow don’t work for what I need.
I am trying to create a program that keeps account of clothing that is lent to a certain person in the cadet force. So for example….
User walks in and asks for a combat jacket > *program loads up onto a form that holds a datagrid view and displays all the members. The assistant selects the users account from the datagrid viewer and clicks a button saying ‘select’. The program then loads the information that is held in a table called tblClothing into labels and textboxs etc saying what they have. I.e: Combat Jacket is loaded into a label, ‘2’ is loaded into a numerical box to say they have 2 combat jackets issued, and a check box is checked to say the item has been issued but not returned.* > we find a correct combat jacket and give it to the user who then goes. > *back in the program the numerical box is updated to ‘3’ by the assistant so we now know that 3 combat jackets have been issued to that user and if we do not have 3 returned then we can charge them for the loss. The assistant then clicks the ‘save button’ and the updated information is saved back into the database.*
I know that all seems very complicated but when you actually think about it not much actually happens. Below is a picture of what I imagine the database structure and relationships to look like but could you please tell me any recommendations you have for me to change it.
Ok so presuming the database is good, the next help I need is linking that database into the form. I understand how to get it to show in the datagrid view but I do not know how to select a row and load it’s separate cells into textboxs etc….
Thanks for any help, it’s all appreciated….please try to help
I have also attached my soloution so if you want to d/l and see what i imagine for myself please do. It should help you understand better. Thanks
I am trying to create a program that keeps account of clothing that is lent to a certain person in the cadet force. So for example….
User walks in and asks for a combat jacket > *program loads up onto a form that holds a datagrid view and displays all the members. The assistant selects the users account from the datagrid viewer and clicks a button saying ‘select’. The program then loads the information that is held in a table called tblClothing into labels and textboxs etc saying what they have. I.e: Combat Jacket is loaded into a label, ‘2’ is loaded into a numerical box to say they have 2 combat jackets issued, and a check box is checked to say the item has been issued but not returned.* > we find a correct combat jacket and give it to the user who then goes. > *back in the program the numerical box is updated to ‘3’ by the assistant so we now know that 3 combat jackets have been issued to that user and if we do not have 3 returned then we can charge them for the loss. The assistant then clicks the ‘save button’ and the updated information is saved back into the database.*
I know that all seems very complicated but when you actually think about it not much actually happens. Below is a picture of what I imagine the database structure and relationships to look like but could you please tell me any recommendations you have for me to change it.
VB.NET Syntax (Toggle Plain Text)
http://i223.photobucket.com/albums/dd28/echocpt/tbls.jpg
Ok so presuming the database is good, the next help I need is linking that database into the form. I understand how to get it to show in the datagrid view but I do not know how to select a row and load it’s separate cells into textboxs etc….
Thanks for any help, it’s all appreciated….please try to help
I have also attached my soloution so if you want to d/l and see what i imagine for myself please do. It should help you understand better. Thanks
•
•
Join Date: Dec 2007
Posts: 252
Reputation:
Solved Threads: 27
I have used this code when a row in the datagrid is doubleclicked.
Hope this helps.
VB.NET Syntax (Toggle Plain Text)
Private Sub dgvOrders_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) orderid = Me.dgvOrders.SelectedCells(0).Value Dim myconnection As New SqlConnection(myconn) Dim sstring As String = "SELECT * From Orders Where OrderId = " & orderid & "" Dim mycomm As New SqlCommand(sstring, myconnection) myconnection.Open() Dim myReader As SqlDataReader = mycomm.ExecuteReader() While (myReader.Read()) price = (myReader.GetDecimal(0)) Me.txtCCNum.Text = (myReader.GetString(1)) Me.txtCCExp.Text = (myReader.GetString(2)) Me.txtName.Text = (myReader.GetString(3)) Me.txtCCSec.Text = (myReader.GetString(4)) Me.txtAddy.Text = (myReader.GetString(5)) Me.txtCCType.Text = (myReader.GetString(6)) End While myReader.Close() End Sub
Hope this helps.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
I have used this code when a row in the datagrid is doubleclicked.
VB.NET Syntax (Toggle Plain Text)
Private Sub dgvOrders_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) orderid = Me.dgvOrders.SelectedCells(0).Value Dim myconnection As New SqlConnection(myconn) Dim sstring As String = "SELECT * From Orders Where OrderId = " & orderid & "" Dim mycomm As New SqlCommand(sstring, myconnection) myconnection.Open() Dim myReader As SqlDataReader = mycomm.ExecuteReader() While (myReader.Read()) price = (myReader.GetDecimal(0)) Me.txtCCNum.Text = (myReader.GetString(1)) Me.txtCCExp.Text = (myReader.GetString(2)) Me.txtName.Text = (myReader.GetString(3)) Me.txtCCSec.Text = (myReader.GetString(4)) Me.txtAddy.Text = (myReader.GetString(5)) Me.txtCCType.Text = (myReader.GetString(6)) End While myReader.Close() End Sub
Hope this helps.
VB.NET Syntax (Toggle Plain Text)
Format of the initialization string does not conform to specification starting at index 0.
I think maybe this has something to do with my database structue? I'm realy not sure tho. If you want to see the database I am using its attached to this reply.
The code I put into my program was this, but there were some bits I'm ashamed to say i did'nt quite understand. I highlighted them in red
Private Sub btnUserSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUserSelect.Click
Dim orderid As String
Dim price As String
orderid = Me.dgvMembers.SelectedCells(0).Value
Dim myconnection As New OleDb.OleDbConnection("C:\Documents and Settings\Alex\My Documents\Database2.mdb")
Dim sstring As String = "SELECT * From Orders Where OrderId = " & orderid & ""
Dim mycomm As New OleDb.OleDbCommand(sstring, myconnection)
myconnection.Open()
Dim myReader As OleDb.OleDbDataReader = mycomm.ExecuteReader()
While (myReader.Read())
price = (myReader.GetDecimal(0))
Me.txtUser.Text = (myReader.GetString(1))
Me.txtFirst.Text = (myReader.GetString(2))
Me.txtLast.Text = (myReader.GetString(3))
Me.txtYear.Text = (myReader.GetString(4))
Me.txtSection.Text = (myReader.GetString(5))
End While
myReader.Close()
End SubThanks for the help so far much appretiated, hope to hear from you soon.
Last edited by echocpt; Jan 12th, 2008 at 12:24 pm.
•
•
Join Date: Aug 2007
Posts: 8
Reputation:
Solved Threads: 0
ok forget that last post......i'v played around more with the code and this is what i have it looking like....
However could someone please tell me why this error is coming up on the line in red in the code above
Thanks for anyhelp
Private Sub btnUserSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUserSelect.Click
Dim username As String
USERNAME = Me.dgvMembers.SelectedCells(0).Value
Dim con As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand()
Dim sConStr As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data " _
& "Source=C:\Documents and Settings\Alex\My Documents\Database2.mdb"
con = New OleDb.OleDbConnection(sConStr)
cmd.Connection = con
cmd.CommandText = "SELECT * From TBLCADETS Where USERNAME = " & username & ""
con.Open()
Dim myReader As OleDb.OleDbDataReader = cmd.ExecuteReader()
While (myReader.Read())
Me.txtUser.Text = (myReader.GetString(1))
Me.txtFirst.Text = (myReader.GetString(2))
Me.txtLast.Text = (myReader.GetString(3))
Me.txtYear.Text = (myReader.GetString(4))
Me.txtSection.Text = (myReader.GetString(5))
End While
myReader.Close()
con.Close()
End SubHowever could someone please tell me why this error is coming up on the line in red in the code above
VB.NET Syntax (Toggle Plain Text)
No value given for one or more required parameter.
Thanks for anyhelp
![]() |
Similar Threads
- What's the HARDEST program you've written? (Computer Science)
- need a good graphics program (Graphics and Multimedia)
- Paint shop Pro 7 (Graphics and Multimedia)
- Have an error in my program (C++)
- Error on "basket" of an e-shop (PHP)
- All .exe files need another program to open them??!! (Windows 95 / 98 / Me)
- weres there a free paint shop (Windows 95 / 98 / Me)
Other Threads in the VB.NET Forum
- Previous Thread: Marquee?????
- Next Thread: Upload a file!!!
| Thread Tools | Search this Thread |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial server soap sql table tcp text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





