AandC's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 6 (0.01 per day)
- Joined:
- 21-February 12
- Profile Views:
- 373
- Last Active:
Mar 07 2012 07:55 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Data From Database is Displayed on Listbox and Sum of it on a Textbox.
Posted 22 Feb 2012
oh btw, here's the final code if anyone is also in need of this.
Dim sum As Double For x As Integer = 0 To ListBox1.Items.Count - 1 sum += CDbl(ListBox1.Items(x).Item(5)) '<<-- this number right here is the column number i believe i just changed it to the number of my amount/price column in my database' Next TotalTextBox.Text = sum.ToString -
In Topic: Data From Database is Displayed on Listbox and Sum of it on a Textbox.
Posted 22 Feb 2012
CharlieMay, on 21 February 2012 - 08:18 AM, said:So you have 3 columns (column 0, 1 & 2)
I think then that you can get the Amount/Price by using
sum += CDbl(ListBox1.Items(x).Item(2))
In other words, select the row with Items(x) and in that row show me the 3rd item.
MAAAAAAAAAAAAAAAN!!!! THANNNKKKK YOUUUUU SO MUUUUUUUUUUCCCCCHHHHH!!!!!! +1,000,000,000 for you! Iloveyou sir!! it totally solved my problem!!! thanks!!!! -
In Topic: Data From Database is Displayed on Listbox and Sum of it on a Textbox.
Posted 21 Feb 2012
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Count As Integer = 0 TextBox9.Text = (TextBox1.Text) 'Search command PatientTableAdapter.PatientnumberP(Me.UsersDataSet.Patient, TextBox1.Text) Count = PatientDataGridView.Rows.Count If Count <= 0 And PatientnumberTextBox.Text = PatientnumberpinTextBox.Text Then MsgBox("No Patient Data Found, Please Check if Lastname is spelled correctly", MsgBoxStyle.Exclamation, "Not Found") End If 'Pnumber is a query it searches for the Patientnumber SupplyandbillingTableAdapter.Pnumber(Me.UsersDataSet.Supplyandbilling, TextBox9.Text)
that is the whole code for the search button. after it searches for the patientnumber the records from the supplyandbilling database displays also. -
In Topic: Data From Database is Displayed on Listbox and Sum of it on a Textbox.
Posted 21 Feb 2012
Phew, i cant seem to find the Edit Button
okay additional info, If a Patient Purchased two Items from the Supply Department, and then checks from the Billing department for his/her purchased items list, Every Row of the "Amount/Price" Column with the same Patientnumber is displayed to the Listbox.
example.
User searched for patientnumber 110001.
then in the following listbox, the records/data from the database is displayed.
Itemname Itemnumber Amount/Price
Medicine 5500 50
Syringe 5201 25
So basically all i need is the Total of the Amount/Price Column displayed into the textbox. I could post the whole code i have for that form, but i don't think it's needed.
btw i'm using vb.net 2008 and SQL Server 2008. thanks a lot! -
In Topic: Data From Database is Displayed on Listbox and Sum of it on a Textbox.
Posted 21 Feb 2012
I'll try if it works thanks.
The Numbers/Data that appears on the Listbox is actually a record/data from a SQL Database.
the Database is called BillingandSupply, and it Contains columns:
PatientNumber, Amount/Price, Items Purchased, Itemnumber, DatePurchased, etc.
so in a form called "Billing", A user Searches for a "PatientNumber" From the database then all the Records of that Patient is displayed on what items he/she bought into the Listboxes, for example.
Patientnumber 110001 , Itemspurchased Medicine, Itemnumber 5501, DatePurchased 2/21/12, Amount/Price 120.
If the Patient makes another transaction from the SupplyForm and makes another purchase of an item, it's then saved to the database and makes another record for the BillingForm to display on the Listbox when the user searched again for that same patientnumber.
I hope i explained it well, thanks again!
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Click here to e-mail me
Friends
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
AandC has no profile comments yet. Why not say hello?