|
Seems straightforward to me
Dim dtTable As New DataTable
Dim row As DataRow
Dim DtReceived As String = ""
Dim DtBackorder As String = ""
Dim DtCanceled As String = ""
Dim customername As String
Dim status As String = vbNull
Dim Conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Scanning Files;Extended Properties=""Text;HDR=No;FMT=FixedLength"""
Dim SQLstr As String = OrderFile
Dim da As New OleDb.OleDbDataAdapter(SQLstr, Conn)
Your data sources are the same, but if they are meant to be different, you can just cut that bit out of the string, and throw the variable in.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
But how do I handle the orderfile variable as far as setting it equal to the two text files lsprint_MO_temp.txt & lsprint_MS_temp.txt?
|
|
|
|
|
I don't understand. You pass it in. In quotes. If you want to always do select *, then you do this:
Dim SQLstr As String = "SELECT * FROM " & orderFile
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
I think that you need to declare a couple variables, set them to the strings you want to use, call the sub or the function.
Dim ConStr As String
Dim SqlStr As String
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Scanning Files;Extended Properties=""Text;HDR=No;FMT=FixedLength"""
SqlStr = "SELECT * FROM lsprint_MO_temp.txt"
connectToDB(ConStr, SqlStr)'Call to the function
End Sub
Private Sub connectToDB(ByVal ConStr As String, ByVal sqlStr As String)
Dim da As New OleDb.OleDbDataAdapter
End Sub
alternatively do this to return a value
Private Function connectToDB(ByVal ConStr As String, ByVal sqlStr As String)as dataset
Dim da As New OleDb.OleDbDataAdapter(ConsStr, sqlStr)
'Fill dataset here. da.fill()
Return TheDataset
End Sub
Of course even better would be to create a class and reuse it everytime you access the databases.
clanguage
Software Engineer
|
|
|
|
|
I am having a problem designing my report.
My report is suppose to print a list of cards from a table base on a batch code supply to the system.
ie. in the table, there is say. 6 columns ...batchcode... permitcode.. firstname...lastname...issuedDate...expiredDate
when i run the program, i want the user to supply the batch code to list the applicants that comes with that batch code....
at the top of the query sheet i want the batch code at the top..since everyone would come under that code..
So basically, i need help in doing dynamic crystal reporting..
how do i set this up so when i run the program i can print a list of all applicants that have that batch code...
can any send me a tutorial explaining how i go about accomplishing this...need help...
thanks in advance...
Nab
|
|
|
|
|
Pls I want to make my windows program to run on network.
I have my program and backend on pc1. how do I create client versions to run on other PCs and also limit the number clients.
What code do I have to add.
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
one way is .net remoting.
search about it.
|
|
|
|
|
i m working in vb.net 2005.i m using datagridview.In this datagrid,i want make style of one coloumn as combobox.and i want to bind that coloumn with database table on sql server.So,give code for this.
Sameer
|
|
|
|
|
Hi to everybody
I use Visual Studio 2005.
I have an MDI form and when I open child forms I want their instances to be entered in a ToolStripMenu named Windows. For example when I will open Childform1 and Childform2 I want the dropdownitems of Windows ToolStripMenu to be Childform 1 and Childform 2. When I click to Childform 1 I want to show the Childform1 and when I click to Childform 2 to show the Childform2 and to hide (the other one).
I can create the Items (runtime) but I cannot handle the click event since the object has been created runtime.
Do you have any idea how to do it, or how to handle events of objects that has been created runtime.
|
|
|
|
|
Search on Addhandler
Shreekar
|
|
|
|
|
i want send mail msg from smtp server see thes code
Dim MA As New MailMessage
MA.Subject = "hi"
MA.BodyFormat = MailFormat.Text
MA.Body = RichTextBox1.text '//error in Here
MA.From = "ahmedbondok1982@hotmail.com"
MA.To = "hakbondok@yahoo.com"
SmtpMail.SmtpServer ="my smtp IP"
SmtpMail.Send(MA)
i want my mail msg body.format text and text siz and color and font get it from RichTextBox1.properties
Plz hel me
and thnx
Ahmed El-Badry
|
|
|
|
|
Try to write a subject that has anything to do with your question. A request for help is totally useless for distinguishing your thread from others, as almost every thread here is a request for help.
What you are asking for is impossibe. If you want to send a message in plain text format, you can't add any formatting to the text.
---
Year happy = new Year(2007);
|
|
|
|
|
thnx to your help
Ahmed El-Badry
|
|
|
|
|
I have been trying to adjust the X and Y axes on my graph so I can have a noticeable distinction between data point values.
The problem is my Y coordinate values range from 0.20 to 0.45, which displays almost a perfectly straight line across my graph.
Is there a way that I can set the Y axis to +1/-1 and the X axis to 0/+1025? Also is there a better way to center the data in the middle of the graph in order to better view the fluctuations?
Here is the portion of my code that prints the data to a panel on a form:
Dim xOne, yOne, xTwo, yTwo As Object
Dim penColor As New Pen(Color.Red, 0.01)
xTwo = 0
yTwo = 75 'center line in middle of graph
For I = 1 To 1024
xOne = I
yOne = Y - Voltage(I) + 75
WavGraph.CreateGraphics.DrawLine(penColor, xTwo, yTwo, xOne, yOne)
xTwo = xOne
yTwo = yOne
Next I
|
|
|
|
|
KojoAmuel wrote: s there a way that I can set the Y axis to +1/-1 and the X axis to 0/+1025? Also is there a better way to center the data in the middle of the graph in order to better view the fluctuations?
Yes, of course. But
KojoAmuel wrote: my Y coordinate values range from 0.20 to 0.45
and what about Voltage(I) range?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The Voltage(I) is an array of 5000
Code:
Public Voltage(5000) As Single
|
|
|
|
|
KojoAmuel wrote: The Voltage(I) is an array of 5000
Sorry for the misunderstanding... but I need the min and max value of Voltage , because you wrote only about Y range, but in your code I see both Y and Voltage(I) (I don't know if you meant 0.20 < (Y - Voltage(I)) < 0.45 )
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
The Y values are:
MinValue -3.4028
MaxValue +3.4028
By running debug mode and viewing a watch function i found that Voltage is:
MinValue = -.0099
MaxValue = 0.21
I did mean to say 0.20 < (Y-Voltage(I)) < 0.45; I randomly grabbed those numbers after running a few tests. What is happening is I am converting a vb6 program to VB.Net, and I am not positive about the Voltage max/min value.
|
|
|
|
|
KojoAmuel wrote: I did mean to say 0.20 < (Y-Voltage(I)) < 0.45
OK, so you can do:
For I = 1 To 1024
xOne = I
yOne = (Y - Voltage(I)-0.20) * 150/(0.45-0.20) + 75
WavGraph.CreateGraphics.DrawLine(penColor, xTwo, yTwo, xOne, yOne)
xTwo = xOne
yTwo = yOne
Next I
supposing you have a 150 pixel height area, such code will use all of it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
It worked, Thank you for all the help.
As another side note to other readers I had modified the DrawLine(....) properties to Integers to keep from having an unhandled exception. (exception was from having Single, and Integer mixed together)
WavGraph.CreateGraphics.DrawLine(penColor, CInt(xTwo), CInt(yTwo), CInt(xOne), CInt(yOne))
|
|
|
|
|
I'm really sorry, but I need to know how to be able to draw free hand on a picture box at runtime. I've looked around and tried bits of code but I can't get it to work. It only needs to be in one colour and the width of the pen is not really an issue. Please get back to me when you can.
Thanks for your time.
-- modified at 8:37 Wednesday 31st January, 2007
Thanks Chris, but I need example or source code to help as I am fairly new to this. As an exercise I need to allow the user to draw free handedly on to a picture box.
|
|
|
|
|
1- Create a form and Add a picturebox named PictureBox1
2- Add these codes to your form
------------
Private m_MouseIsDown As Boolean
Private m_Points() As Point
Dim m_path As New Drawing2D.GraphicsPath
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
m_Points = New Point() {New Point(e.X, e.Y)}
m_MouseIsDown = True
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If m_MouseIsDown Then
ReDim Preserve m_Points(m_Points.Length)
m_Points(m_Points.Length - 1) = New Point(e.X, e.Y)
Me.PictureBox1.Invalidate()
End If
End Sub
Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
m_path.StartFigure()
m_path.AddCurve(m_Points)
m_MouseIsDown = False
Me.PictureBox1.Invalidate()
End Sub
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
If m_Points IsNot Nothing Then
Using p As New System.Drawing.Pen(Color.Blue, 2)
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
e.Graphics.DrawPath(p, m_path)
e.Graphics.DrawCurve(p, m_Points)
End Using
End If
End Sub
------------
3- Run your project
now by downing mouse left key and moving mouse, your freehand drawing is painting.
|
|
|
|
|
wrote: As an exercise I need to allow the user to draw free handedly on to a picture box.
If you just want to draw a single line, then the sample you have been given will work. However, drawing on a picturebox is a waste of time, you can take this sample and remove the picture box, it will still work on a form the same way. To draw on a picture box, you need to draw on a bitmap, and show it in the picture box. The picture box is, in every case, totally superfluous and useless. It just adds a needless layer to what you are doing.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
I need the user to draw line in panel control placed in form. For that I have defined mousedown, mouseup and mousemove events. But it draws the line continously, I need it to be as like drawing line in paint brush.
Dim oldX, oldY As Integer
Dim m_Down As Boolean
Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
oldX = e.X
oldY = e.Y
m_Down = True
End Sub
Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If m_Down = True Then
Dim p As Point
Dim g As Graphics
Dim pn As Pen
p = New Point(e.X, e.Y)
g = Graphics.FromHwnd(Panel1.Handle)
pn = New Pen(Color.Red, 1)
g.DrawLine(pn, oldX, oldY, e.X, e.Y)
pn.Dispose()
g.Dispose()
End If
End Sub
Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
m_Down = False
End Sub
Any help?
Be simple and Be sample.
|
|
|
|
|
Do you mean you want a straight line? Not freehand?
|
|
|
|