Thanks it is working.
I am using this code please can you modify it to check duplicate record.
Try
'Set up connection string
Dim cnString As String
cnString = ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\Payment.mdb;")
'Dim sqlQRY As String = "SELECT * FROM CustomerInformation WHERE CustomerName = '" & TextBox5.Text & "'"
'Create connection
Dim conn As OleDbConnection = New OleDbConnection(cnString)
'Try
' Open connection
conn.Open()
Dim sqlQRY As String = "SELECT * FROM CustomerInformation WHERE CustomerName = '" & TextBox1.Text & "'"
'create data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY, conn)
'create dataset
Dim ds As DataSet = New DataSet
'fill dataset
da.Fill(ds, "CustomerInformation")
'get data table
Dim dt As DataTable = ds.Tables("CustomerInformation")
'display data
'Dim row As DataRow
'For Each row In dt.Rows
'TextBox1.Text = row("CustomerName")
'Next row
If ds.Tables("CustomerInformation").Rows.Count = 0 Then
MessageBox.Show("Already Exists!", "ALI ENTERPRISES", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
If Asc(e.KeyChar) = 13 Then
TextBox2.Focus()
End If
' Close connection
conn.Close()
Catch ex As OleDbException
MessageBox.Show("Customer Not found" + ex.Message)
End Try
I want to check it on keypress event
i want to populate a message like "record already exists
Dear All,
How Can i prevent duplicate record entry in vb.net. Please help
I have developed my project now i want to make setup how can i do this please help thanks in advance.
Can i pass the value of two perametrs from single textbox? How can i do this please help.
Actully dates are not Linked with database user input any two dates and want to get result between to dates how can i do this?
Dear All,
I am using this code for single perameter
Dim cryRpt As New ReportDocument
cryRpt.Load("C:\PaymentSystem\PaymentSystem\Inst1.rpt")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = TextBox1.Text
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("PlotNo")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
And for permetor field i use this code
view sourceprint?1 {instalment.PlotNo } = {?PlotNo}
How can i pass multiple peremeter please help thanks in advance.
I have made report with one date perameter it works fine but it didn't work with two peramets.I want to pass two dates and want to get result between two dates from same table.
Code i am using for single table is
(PaymentDate.Instalment) = (?PaymentDate)
it is generating 7 every time form load ok let me explain
1. I want to generate auto number stating from 1
2. Then i want to increment it at evey transaction.
or
Is it possible that it every time generate auto number every time when form loaded?
Please help me if it is possible.
Thanks for your help nut it s generating 7 by default.
I want to generate auto number every time when form loaded please help me.
How can i generarte crstal report bwtween two dates by passing two perameters in vb.net
Thnaks in advance.
Dear All,
I am calling a perameter crstal report which i have made in visual studio when i enter criteria in textbox it does not compare and prompt all the record how to resolve it please help.
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = TextBox1.Text
crParameterFieldDefinitions = -
cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("Customername")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
End Class
When i run the report there comes an error "Invalid data source i am using this code
Dim cryRpt As New ReportDocument
cryRpt.Load("C:\PaymentSystem\PaymentSystem\Instalment.rpt")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = TextBox1.Text
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("Customername")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
Still it did not have any effect it does not take any settings which i made
Can i set margins if so then please tell me how?
I am using this code but pagesetup dilog does not effect the print.
With PageSetupDialog1
.PageSettings = PrintDocument1.DefaultPageSettings
End With
If PageSetupDialog1.ShowDialog = DialogResult.OK Then
PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings
PrintForm1.Print()
Dear all,
Q.No.1
1. I want to make a crystal report
2. It should have two datatimepicker
3. User select two diiferent dates and report must be run
Q.No.2
1. How can i run a report when i pass a perametor from textbox.
Please give me some Code thanks in advance form your great help.
Thank you so much dear you are realy very great its working thanks alot.
form width is '352' and form height is '498' and i want to print take print on right side how can i do this. please help me thanks in advance.
Dear it would be much better if you send me a form having the coding example of printing whichi needed i would be very thankfull to you.
Thyanks in advance.
I m waiting for your kind reply once agin thaks for your great help.
yes the texboxes printed after the text but i just want to print text and also there is an error in this line
e.Graphics.DrawString(line, Me.Font, Brushes.Black, leftMargin, yPosition)
error is line statement is no longer supported I/O........
Please help
I want to just print the text present in textboxes.
but the code given by you prints both text present in trexboxes and also the textboxes.
Ok you can
1. add datareport by opning the project you have made
2. Right click on Your project name for example project1 then click on add it will populate another list then choose datareport from there now the datareport would included in your project.
If you have any other problem then let me.
Now it is working but
"It is ptrinting the contents of textboxes with textboxes but i want to print only contents without textboxes"
Please help me thanks in advance.
I have problem in printing i send the print but the blank page comes code i am using as follows:
Dim linesPerPage As Single = 0
Dim yPosition As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = e.MarginBounds.Left
Dim topMargin As Single = e.MarginBounds.Top
Dim printFont As Font = Me.Font
Dim myBrush As New SolidBrush(Color.Black)
'Dim text() As String = TextBox1.Lines
Dim text() As String = New String() {TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox9.Text}
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
Try
For i As Integer = 0 To text.Length - 1
If count < linesPerPage Then
yPosition = topMargin + (count * printFont.GetHeight(e.Graphics))
e.Graphics.DrawString(text(i), printFont, myBrush, leftMargin, yPosition, New StringFormat())
count += 1
Else
Exit For
End If
Next
Catch ex As Exception
End Try
e.HasMorePages = True
e.HasMorePages = False
myBrush = Nothing
ok the problem was withevents prn as new printing.document but it does not print any thing page comes black from printer.
it gives me this error
Object reference not set to an instance of an object.
What should i do now???
i have to print the text from text boxes not from richtextbox this code give me error that myBrushes is not declared?
Hi All,
I hope you all would be fine i want to print
1. Only text
2. No controls should be appear in the print like textboxes etc.
Thanks in advance.
can i have coding form which you are using for this purpose.
Please please
Dear All,
Please help me i want to take print of my form in a short slip please give me some code to fit the print siza on the short page i am usin LQ+ 300 printer for this purpose please please help me.
Thanks in advance.
i am using this code but it does not generate the preview of window form in vb.net code is as follows:
Dim printDialog1 As PrintDialog = New PrintDialog
Dim printPreviewDialog1 As New PrintPreviewDialog()
printPreviewDialog1.ShowDialog()
printDialog1.Document = PrintDocument1
Dim result As DialogResult = printDialog1.ShowDialog
If (result = DialogResult.OK) Then
PrintDocument1.Print()
End If
Please help
i think it is included in visual studio 2008
Dear All,
I hope you all would be fine please help me in printing i want to take print preview of window form and after taking print preview want to take print of form how can i do this please provide me example.
Thanks in advance
Dear All,
I have designed a form for a table Instalment from this form i am trying to update a column in other table which is hiring table please guide me how can i do this the code is as folloes thanks in advance.
Dim cnString As String
cnString = ("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\PaymentSystem\PaymentSystem\bin\Debug\Pa yment.mdb;")
Dim sqlQRY As String = "SELECT * FROM Instalment"
'Dim sqlQRY1 As String = "UPDATE hiring(TotalAmount)SET" & _
'" TotalAmount = " & TextBox7.Text & "WHERE PlotNo = & TextBox1.Text"
'Dim sqlQRY1 As String = "Select * from hiring"
'Create connection
Dim conn As OleDbConnection = New OleDbConnection(cnString)
Try
' Open connection
conn.Open()
'create data adapter
Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY, conn)
Dim da1 As OleDbDataAdapter = New OleDbDataAdapter(sqlQRY1, conn)
'create command builder
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da)
Dim cb1 As OleDbCommandBuilder = New OleDbCommandBuilder(da1)
'create dataset
Dim ds As DataSet = New DataSet
Dim ds1 As DataSet = New DataSet
'fill dataset
da.Fill(ds, "Instalment")
da1.Fill(ds1, "Hiring")
'get data table
Dim dt As DataTable = ds.Tables("Instalment")
Dim dt1 As DataTable = ds1.Tables("Hiring")
Dim newRow As DataRow = dt.NewRow()
Dim newrow1 As DataRow = dt1.NewRow()
newRow("PlotNo") = TextBox1.Text
newRow("CustomerName") = TextBox2.Text
newRow("Fname") = TextBox3.Text
newRow("Area") = TextBox4.Text
newRow("TotalAmount") = TextBox5.Text
newRow("RecivedAmount") = TextBox6.Text
newRow("RemainingAmount") = TextBox7.Text
newRow("PaymentDate") = TextBox8.Text
newRow("PaymentReciverName") = TextBox9.Text
newrow1("TotalAmount") = TextBox7.Text
dt.Rows.Add(newRow)
'dt1.Rows.Add(newrow1)
'updat Instalment and Hiring table
If TextBox1.Text = ds.Tables("Instalment").Rows(1).Item(1) Then
Dim sqlQRY1 As String = "UPDATE hiring(TotalAmount)SET" & _
" TotalAmount = " & …