473,657 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1308
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_C ellEndEdit(ByVa l sender As
System.Object, ByVal e As
System.Windows. Forms.DataGridV iewCellEventArg s) Handles
DataGridView1.C ellEndEdit
If e.ColumnIndex = 0 Then
init_conn()
con.Open()
str = swname.DataGrid View.CurrentCel l.Value
cmd1 = New OleDbCommand("s elect * from master_software
where soft_name='" & str & "'", con)
rdr = cmd1.ExecuteRea der
Edition.Items.C lear()
While rdr.Read
Edition.Items.A dd(rdr.Item(4))
End While
Edition.AutoCom plete = True
con.Close()
End If
If e.ColumnIndex = 1 Then
find_manufactur er(str,
Edition.DataGri dView.CurrentCe ll.Value)
End If
If e.ColumnIndex = 3 Then
qty = Quantity.DataGr idView.CurrentC ell.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(st r, con)
i = cmd.ExecuteNonQ uery()
MsgBox(i & " record inserted")
con.Close()
End If
End Sub

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

Private Sub DataGridView1_C ellEnter(ByVal sender As Object, ByVal e
As System.Windows. Forms.DataGridV iewCellEventArg s) Handles
DataGridView1.C ellEnter
If e.ColumnIndex = 2 Then
Manufacturer.Da taGridView.Curr entCell.Value = comp.ToString
If e.ColumnIndex = 4 Then price.DataGridV iew.CurrentCell .Value
= uprice.ToString
If e.ColumnIndex = 5 Then
Total.DataGridV iew.CurrentCell .Value = Int(uprice) *
Int(qty)
'txtqtn_id.Focu s()
'txtqtn_id.Text = "MS-1-05-06"
End If
End Sub
On Jan 2, 8:18 pm, XOR <X...@discussio ns.microsoft.co mwrote:
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
2438
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 represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
2
5128
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? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
8
3125
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 and bind these data to my datagrid in the form, when I click the button first time, it work fine. but when I click the second button. it report belowing error, I guess it is because it already set up the column name at first time, so cann't do...
0
3635
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 datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
1
1507
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 stringValue. The classes that inherit from it use those two properties, plus several properties of their own of types double and vector. I need to display this StatisticsContainer class on a datagrid, but I'm having problems because each of the...
14
1830
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 will be used to populate information coming from a Webservice. (No datasets - No datareaders). So, I do not know see how to use the "datasource".
6
4682
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 when I try this code: "Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier." Dim dr2 As DataRow = dt_stat_report_3b.NewRow Dim sum As Double =...
2
1319
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 Datagrid" I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit in a datagrid so I created a textbox below the datagrid and need it to hold the data for the...
3
2515
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 others. One of the custom format is as follows: dsmessages_dt.Columns.Add("Image", GetType(Image)) I had a problem of when I used a checkbox in the grid that was bound to the datatable that it would not update my dataset. So I created another...
4
2124
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 Delete button on the end of each row. I am unable to gain access to the event when the button is clicked. I don't fully understand how the click gets connected to the C# code,
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.