473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help with Datagrid

Hi,

My requirement is to have the datagrid perform the work of an order
entry system. The specifications are something like this. I have got a
table in MS-Access, named master_software, whose fields are: soft_name,

edition, manufacturer, price.
My data grid would contain the following columns: Software Name,
Edition, Manufacturer, Quantity, Unit Price and Total price, of which
software name and edition are of combobox types. The user would select
the software name from the drop down list and then the next cell should

automatically fill the appropriate editions for that selected software.

After selecting the edition, the price should automatically come in the

Unit price cell and after entering the quantity of the s/w being
ordered, the total price should automatically populate based upon the
calculation.
I have initially written the code using datareaders and
OledbConnection. Later changed it to dataset and dataview. In either of

the cases, it doesn't work. Could anyone help me with this issue?
Regards,
Srikanth

Jan 2 '07 #1
2 1295
sure.

can u post ur code so I can get a clear idea of whats not working.
Jan 3 '07 #2
Hi,

Please find the code:

Private Sub DataGridView1_CellEndEdit(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
init_conn()
con.Open()
str = swname.DataGridView.CurrentCell.Value
cmd1 = New OleDbCommand("select * from master_software
where soft_name='" & str & "'", con)
rdr = cmd1.ExecuteReader
Edition.Items.Clear()
While rdr.Read
Edition.Items.Add(rdr.Item(4))
End While
Edition.AutoComplete = True
con.Close()
End If
If e.ColumnIndex = 1 Then
find_manufacturer(str,
Edition.DataGridView.CurrentCell.Value)
End If
If e.ColumnIndex = 3 Then
qty = Quantity.DataGridView.CurrentCell.Value
End If
If e.ColumnIndex = 5 Then
init_conn()
con.Close()
con.Open()
'MsgBox(orgid)
str = "insert into sw_orders
values('MS-01-05-06','wxp_home'," & orgid & ")"
'str = "insert into sw_orders
values('MS-01-05-06','wxp_home',1002)"
MsgBox(str)
cmd = New OleDbCommand(str, con)
i = cmd.ExecuteNonQuery()
MsgBox(i & " record inserted")
con.Close()
End If
End Sub

Public Sub find_manufacturer(ByVal sw_name As String, ByVal
sw_edition As String)
init_conn()
con.Open()
cmd1 = New OleDbCommand("select * from master_software where
soft_name='" & sw_name & "' and edition='" & sw_edition & "'", con)
rdr = cmd1.ExecuteReader
While rdr.Read
comp = rdr.Item(5)
uprice = rdr.Item(3)
End While
'txtqtn_id.Focus()
'txtqtn_id.Text = "MS-1-05-06"
con.Close()
End Sub

Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellEnter
If e.ColumnIndex = 2 Then
Manufacturer.DataGridView.CurrentCell.Value = comp.ToString
If e.ColumnIndex = 4 Then price.DataGridView.CurrentCell.Value
= uprice.ToString
If e.ColumnIndex = 5 Then
Total.DataGridView.CurrentCell.Value = Int(uprice) *
Int(qty)
'txtqtn_id.Focus()
'txtqtn_id.Text = "MS-1-05-06"
End If
End Sub
On Jan 2, 8:18 pm, XOR <X...@discussions.microsoft.comwrote:
sure.

can u post ur code so I can get a clear idea of whats not working.
Jan 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected...
2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
8
by: pei_world | last post by:
Hi, there; I have a problem with my datagrid control. I declared it in one of my form, set with DataGridTalbeStyle as well, and when I click on button, I would like to retrive Data from Database...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
1
by: Michael Gorbach | last post by:
Iv got a StatisticsContainer object that contains an arraylist of objects of different types, all inherited from class Statistic. The statistics class has 2 string public properties, name and...
14
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
6
by: Coleen | last post by:
Hi All :-) Thanks for all of your help Cor :-) I can not get the code you sent me to work in my application. I'm using an aspx datagrid in a web form. I'm getting the following error message...
2
by: Brad Shook | last post by:
First of all thinks to Cor Ligthert for helping me with this last week. If you wild like to read Cor's comments please refer to the posting from 10/14/2004 and 8:48AM "Help with Advanced...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
4
by: Jeff User | last post by:
Hi I tryed to solve this problem over in the framework.asp group, but still am having trouble. Hope someone here can help. using .net 1.1, VS 2003 and C# I have an asp.DataGrid control with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.