|
Dim people As New List(Of PERSON)(dt.Rows.Count)
For Each dr In dt.Rows
Dim person As New PERSON
person.FIRSTNAME = dr("FIRSTNAME").ToString()
person.LASTNAME = dr("LASTNAME").ToString()
people.Add(person)
Next
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am creating a vb 6.0 project (with sql 2008 as database) on hospital mgmt system. here i m getting 2-3 problems mentioning below:-
1) How to find the total value of different items (i.e. In Pharmacy column i have entered price of different medicines, how to add all medicine's price to find the total price).
2) I need to make a final billing form for patient at the discharging time which will includes all the charges and fees he have to pay (like bed charge,doctor fee,pharmacy bill,tests fee), so how to link the values of all these forms in a separate form.
|
|
|
|
|
Sounds like a generic "order and orderitem" problem.
1) by looping all the stuff that the patient used, and looking up the prices.
2) this is what reports are for.
Kushal Kumar wrote: I am creating a vb 6.0 project No, you shouldn't. Make it VB.NET - it is available for free (vb6 is not free and is no longer sold), and there's a lot more examples and help for VB.NET.
VB6 has been dead for a long time.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Kushal Kumar wrote: I am creating a vb 6.0 project
For f***s sake, WHY ARE YOU USING VB6?? It's been dead and unsupported for quite a while now! As has already been said, get VB.NET and do this in a more modern language.
Kushal Kumar wrote: 1) How to find the total value of different items (i.e. In Pharmacy column i have entered price of different medicines, how to add all medicine's price to find the total price).
You have two options. Either do it in an SQL query or use a For/Next loop to iterate over the items and add each number together. Frankly, if this little part is difficult for you, STOP writing this software right now. A "hospital management system" is not something that should be attempted by someone who doesn't know the basics of what they're doing! YOU could kill someone if you screw up critical sections of code!
Kushal Kumar wrote: 2) I need to make a final billing form for patient at the discharging time which will includes all the charges and fees he have to pay (like bed charge,doctor fee,pharmacy bill,tests fee), so how to link the values of all these forms in a separate form.
Again, you don't have the slightest clue of what you're doing. STOP NOW. Learn how relational databases work. What you're proposing to write is a massive undertaking for someone who doesn't have a clue.
You're not going to get an explanation for the second question simply because it would take an entire book to relate all the concepts to you.
|
|
|
|
|
Just pray that he is not on contract to a hospital near you.
|
|
|
|
|
Yeah, that's what I'm kind of afraid of.
I doubt he's writing this for a U.S. hospital. This seems more like he took a job on vWorker and, like everybody on that site, doesn't have a clue about what he's doing.
|
|
|
|
|
With the number of similar questions being asked, I'm wondering if this is a post-secondary assignment for credit. Many of them quote VB6, so it sounds like that is the installed base.
|
|
|
|
|
Oh wonderful! A bunch of people being ripped off being "taught" out of date skills!
|
|
|
|
|
And will eventually end up quoting peanuts on vWorker!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Good day,
I have a tiff img (img is including pic and text )
Tiff is bigger than 1print page, so I assuming when I call framecount should put 2 pages, but not, always show 1p Page is not completed it showes2/3 1/3 it should go to other page but doesn't show. Sorry I read most of codes what people wrote, but they are not working for me.
If somebody can help will be greatefull
Regards
Drago
|
|
|
|
|
drago11 wrote: when I call framecount
Framecount? On what? The image? It'll always be 1 since it know nothing of the printer that is going to print the image.
The rest of your post is unintelligible. You're going to have to provide quite a bit more detail to your question to get a clear answer.
|
|
|
|
|
Vb net 2010
Tif img
I would like to print that image by calling print preview
Image is larger than one print page.
I cannot get another (second) page where it should be rest of that img.
I'm using
Img.framecount(framedimension .page) where count is always 1, but should be 2.
(To divide 1 tiff img to 2 print pages)
Thanks
Imports System.Drawing.Printing
Imports System.Drawing.Imaging
Imports System.Drawing
Imports System.IO
Public Class Form2
Private fileCount As Integer = 0
Private currPage As Integer = 0
Private pCount As Integer = 0
Private currImage As Image
Private Sub vPrintDocument()
Dim vPrintDoc As New PrintDocument
vPrintDoc.DefaultPageSettings.Landscape = False
AddHandler vPrintDoc.PrintPage, AddressOf docPrintPage
AddHandler vPrintDoc.BeginPrint, AddressOf docBeginPrint
Dim i As PrintPreviewDialog = New PrintPreviewDialog
i.Document = vPrintDoc
i.ShowDialog()
End Sub
Private Sub docBeginPrint(ByVal sender As Object, ByVal e As PrintEventArgs)
currPage = 0
currImage = Image.FromFile("C:\out.tif")
pCount = currImage.GetFrameCount(Imaging.FrameDimension.Page)
‘MsgBox(pCount)
End Sub
Private Sub docPrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
currImage.SelectActiveFrame(Imaging.FrameDimension.Page, currPage)
e.Graphics.DrawImage(currImage, 20, 20)
currPage = currPage + 1
If currPage < pCount Then
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call vPrintDocument()
End Sub
End Class
modified 28-Sep-14 2:21am.
|
|
|
|
|
That method does not return the amount of pages that the image is printed on; it returns the amount of frames[^] (total images in an animation) in there.
If you want to know how many pages are needed to print something, then you'd have to create a print-preview using the printer-driver.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Again, FrameCount should return 1, unless this is a multiframe, "animated" image. The image knows NOTHING about what you're displaying the image on or printing it on. How could it possibly know??
If you need to print the entire image on multiple pages, YOU have to write the code that breaks the image up into multiple images and figures out exactly what dimensions each sub-image has to be based on the printable area of the selected printer page.
|
|
|
|
|
Thanks Dave, Eddy
Do you have any ideas how I can do that...
|
|
|
|
|
Answered here[^] by the topicstarter.
I upvoted the answer since he took the time to share it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm wondering if this is a post-secondary assignment for credit.
http://www.falgames.com/
|
|
|
|
|
I thought I seen an example up here before But I will be dang if I can find it now.
I have a panel control which has geometry created on it from a third party dll. What I would like to do is that and create an image (preferably with transparent background) of what the user is seeing on that screen.
can anyone point me in the right direction?
Oh I guess I should mention that I am using VS2013 vb.net
Thanks
|
|
|
|
|
A panel is a control, and those can be drawn to a bitmap. See MSDN[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks for the advice but that does not create a transparent bitmap and in most cases will not work if the actual drawing to the panel is done through a 3rd party dll.
I think what I really need is more of a screen capture of the panel and then convert its size and transparentcy
|
|
|
|
|
I found this bit of code to work with 2 exceptions. 1) how to re-size it to a smaller image (So I can display a thumbnail type image and 2) how to make the background transparent.
I want item 2 because the image is displayed in a panel control with a black background. That is what the user needs to see. But when I create the image I do not want the black background
Private Sub my_capture(ctrl As Control, fileName As String)
Dim bounds As Rectangle = ctrl.Bounds
Dim pt As Point = ctrl.PointToScreen(bounds.Location)
Dim bitmap As New Bitmap(bounds.Width, bounds.Height)
Using g As Graphics = Graphics.FromImage(bitmap)
g.CopyFromScreen(New Point(pt.X - ctrl.Location.X, pt.Y - ctrl.Location.Y), Point.Empty, bounds.Size)
End Using
bitmap.Save(fileName, ImageFormat.Png)
End Sub
|
|
|
|
|
You'd have to specify which color should become transparent[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I changed my code to this:
But it had no effect. I still get the image with a black background.
I am not sure how to include images with the reply otherwise I would show you before and after images
Dim bounds As Rectangle = ctrl.Bounds
Dim pt As Point = ctrl.PointToScreen(bounds.Location)
Dim myBitmap As New Bitmap(bounds.Width, bounds.Height)
myBitmap.MakeTransparent(ctrl.BackColor)
Using m_g As Graphics = Graphics.FromImage(myBitmap)
m_g.CopyFromScreen(New Point(pt.X - ctrl.Location.X, pt.Y - ctrl.Location.Y), Point.Empty, bounds.Size)
m_g.Dispose()
End Using
myBitmap.Save(fileName, ImageFormat.Png)
myBitmap.Dispose()
|
|
|
|
|
Hi
Imports System.Drawing.Imaging
Imports System.Drawing.Printing
Private Sub PrintDocument1_PrintPage(ByVal Sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Static page As Integer = 1
Dim startPosition As Integer = (page - 1) * PrintDocument1.DefaultPageSettings.Bounds.Height
Static maxPages As Integer = 0
If page = 1 Then
For Each ctrl As Control In Me.pRight19.Controls
If TypeOf ctrl Is TextBox Or TypeOf ctrl Is Label Or TypeOf ctrl Is PictureBox Or TypeOf ctrl Is RichTextBox Then
ctrl.Tag = Int((ctrl.Top + ctrl.Height) / PrintDocument1.DefaultPageSettings.Bounds.Height) + 1
If CInt(ctrl.Tag) > maxPages Then maxPages = CInt(ctrl.Tag)
End If
Next
End If
For Each ctrl As Control In Me.pRight19.Controls
If CInt(ctrl.Tag) = page Then
If TypeOf ctrl Is TextBox Or TypeOf ctrl Is Label Or TypeOf ctrl Is RichTextBox Then
Dim sf As New System.Drawing.StringFormat
If TypeOf ctrl Is TextBox Then
If DirectCast(ctrl, TextBox).TextAlign = HorizontalAlignment.Right Then
sf.Alignment = StringAlignment.Far
Else
sf.Alignment = StringAlignment.Near
End If
ElseIf TypeOf ctrl Is Label Then
If DirectCast(ctrl, Label).TextAlign = ContentAlignment.TopLeft Then
sf.Alignment = StringAlignment.Far
End If
ElseIf TypeOf ctrl Is RichTextBox Then
If DirectCast(ctrl, RichTextBox).SelectionAlignment = ContentAlignment.TopLeft Then
sf.Alignment = StringAlignment.Near
End If
End If
sf.FormatFlags = StringFormatFlags.NoClip
e.Graphics.DrawString(ctrl.Text, ctrl.Font, New SolidBrush(ctrl.ForeColor), New Rectangle(ctrl.Left, ctrl.Top - startPosition, ctrl.Width + 50, ctrl.Height), sf)
ElseIf TypeOf ctrl Is PictureBox Then
e.Graphics.DrawImage(DirectCast(ctrl, PictureBox).Image, New PointF(ctrl.Left, ctrl.Top - startPosition))
End If
End If
Next
page += 1
If page > maxPages Then
e.HasMorePages = False
page = 1
maxPages = 0
Else
e.HasMorePages = True
End If
End Sub
Private Sub ToolStripButton1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
' PrintDocument1.Print()
PrintPreviewDialog1.Document = PrintDocument1
PrintPreviewDialog1.ShowDialog()
End Sub
|
|
|
|
|
Drago11
I am not sure what all the printing code has to do with my question. Maybe you just pasted it in to the wrong question. Am I missing something?
|
|
|
|