Hi,
I have an Access database in my program that holds names and room numbers. They are meant to go on those Avery label stickers but I am not sure how to get the data into a form that I can manipulate into the proper format. I'm not sure what else to say/ include.
Thanks in advance.
3 1197
Hello there, Fenris54!
I hate to do this to you. You are hoping for a great response, I'm sure. But would you mind posting what you have working thus far, so one can have a closer look? I will be honest in saying I ahve not yet tackled VB Express. Knowledgeable and helpful members here will see your post and will assist if something is posted. How's that for a deal?
Good luck with the project!
Dököll
No problem. I wasn't sure if it would be needed. But this is what I have. I basically have 2 forms. One is for adding, deleting, and viewing the database and the other is for printing. There are 30 buttons (Just like the avery label stickers) that when you click on it, it would make sure that when the label printed the printer would skip over that label space. (So you aren't printing over blank labels.)
I apologize for the lack of comments. I always comment after I finish coding.
Code for form1 -
Public Class frmLabelPrinter
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
'TODO: This line of code loads data into the 'LabelPrinterDS.tblEmployees' table. You can move, or remove it, as needed.
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
-
End Sub
-
-
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
-
End
-
End Sub
-
-
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
-
Try
-
If chkAttending.Checked = True Then
-
TblEmployeesTableAdapter.Insert(txtFirstName.Text, txtLastName.Text, txtRoomNum.Text, True)
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
End If
-
If chkAttending.Checked = False Then
-
TblEmployeesTableAdapter.Insert(txtFirstName.Text, txtLastName.Text, txtRoomNum.Text, False)
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
End If
-
Catch ex As Exception
-
MessageBox.Show(ex.Message, "Data Input Error")
-
End Try
-
-
txtFirstName.Clear()
-
txtLastName.Clear()
-
txtRoomNum.Clear()
-
chkAttending.Checked = True
-
txtFirstName.Focus()
-
End Sub
-
-
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
-
Dim IDNum As Integer = txtID.Text
-
Dim row As DataRow = LabelPrinterDS.tblEmployees.FindByID(IDNum)
-
LabelPrinterDS.tblEmployees.Rows.Remove(row)
-
-
txtID.Clear()
-
txtID.Focus()
-
End Sub
-
-
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
-
My.Forms.frmPrinting.Show()
-
End Sub
-
-
Private Sub txtFirstName_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFirstName.GotFocus, txtLastName.GotFocus, txtRoomNum.GotFocus, txtID.GotFocus
-
sender.Backcolor = Color.LemonChiffon
-
End Sub
-
-
Private Sub txtFirstName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFirstName.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
txtLastName.Focus()
-
End If
-
End Sub
-
-
Private Sub txtLastName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtLastName.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
txtRoomNum.Focus()
-
End If
-
End Sub
-
-
Private Sub txtRoomNum_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRoomNum.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
chkAttending.Focus()
-
End If
-
End Sub
-
-
Private Sub txtID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtID.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
btnDelete.Focus()
-
End If
-
End Sub
-
-
Private Sub txtFirstName_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFirstName.LostFocus, txtLastName.LostFocus, txtRoomNum.LostFocus, txtID.LostFocus
-
sender.BackColor = Color.White
-
End Sub
-
-
Private Sub chkAttending_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles chkAttending.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
btnAdd.Focus()
-
End If
-
End Sub
-
End Class
-
Code for form 2 (I haven't written the code for the buttons yet, I am working on the math for spacing. -
Public Class frmPrinting
-
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
-
End
-
End Sub
-
-
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
-
My.Forms.frmLabelPrinter.Show()
-
End Sub
-
-
Private Sub btnPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintPreview.Click
-
ppdDialog.ShowDialog()
-
End Sub
-
-
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
-
pdDocument.Print()
-
End Sub
-
-
End Class
-
No problem. I wasn't sure if it would be needed. But this is what I have. I basically have 2 forms. One is for adding, deleting, and viewing the database and the other is for printing. There are 30 buttons (Just like the avery label stickers) that when you click on it, it would make sure that when the label printed the printer would skip over that label space. (So you aren't printing over blank labels.)
I apologize for the lack of comments. I always comment after I finish coding.
Code for form1 -
Public Class frmLabelPrinter
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
'TODO: This line of code loads data into the 'LabelPrinterDS.tblEmployees' table. You can move, or remove it, as needed.
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
-
End Sub
-
-
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
-
End
-
End Sub
-
-
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
-
Try
-
If chkAttending.Checked = True Then
-
TblEmployeesTableAdapter.Insert(txtFirstName.Text, txtLastName.Text, txtRoomNum.Text, True)
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
End If
-
If chkAttending.Checked = False Then
-
TblEmployeesTableAdapter.Insert(txtFirstName.Text, txtLastName.Text, txtRoomNum.Text, False)
-
Me.TblEmployeesTableAdapter.Fill(Me.LabelPrinterDS.tblEmployees)
-
End If
-
Catch ex As Exception
-
MessageBox.Show(ex.Message, "Data Input Error")
-
End Try
-
-
txtFirstName.Clear()
-
txtLastName.Clear()
-
txtRoomNum.Clear()
-
chkAttending.Checked = True
-
txtFirstName.Focus()
-
End Sub
-
-
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
-
Dim IDNum As Integer = txtID.Text
-
Dim row As DataRow = LabelPrinterDS.tblEmployees.FindByID(IDNum)
-
LabelPrinterDS.tblEmployees.Rows.Remove(row)
-
-
txtID.Clear()
-
txtID.Focus()
-
End Sub
-
-
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
-
My.Forms.frmPrinting.Show()
-
End Sub
-
-
Private Sub txtFirstName_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFirstName.GotFocus, txtLastName.GotFocus, txtRoomNum.GotFocus, txtID.GotFocus
-
sender.Backcolor = Color.LemonChiffon
-
End Sub
-
-
Private Sub txtFirstName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFirstName.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
txtLastName.Focus()
-
End If
-
End Sub
-
-
Private Sub txtLastName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtLastName.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
txtRoomNum.Focus()
-
End If
-
End Sub
-
-
Private Sub txtRoomNum_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRoomNum.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
chkAttending.Focus()
-
End If
-
End Sub
-
-
Private Sub txtID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtID.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
btnDelete.Focus()
-
End If
-
End Sub
-
-
Private Sub txtFirstName_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFirstName.LostFocus, txtLastName.LostFocus, txtRoomNum.LostFocus, txtID.LostFocus
-
sender.BackColor = Color.White
-
End Sub
-
-
Private Sub chkAttending_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles chkAttending.KeyPress
-
If e.KeyChar = Chr(Keys.Enter) Then
-
btnAdd.Focus()
-
End If
-
End Sub
-
End Class
-
Code for form 2 (I haven't written the code for the buttons yet, I am working on the math for spacing. -
Public Class frmPrinting
-
-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
-
End
-
End Sub
-
-
Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
-
My.Forms.frmLabelPrinter.Show()
-
End Sub
-
-
Private Sub btnPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintPreview.Click
-
ppdDialog.ShowDialog()
-
End Sub
-
-
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
-
pdDocument.Print()
-
End Sub
-
-
End Class
-
No problem, thanks for your prompt reply. Please stay tuned. Someone should see this and will likely help or at least point you in the right direction...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael |
last post by:
Hi,
I've read Scott's article:
http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
but when I try to create a new database file in App_Data with
Visual Studio 2005, it shows error:
...
|
by: Patrick F |
last post by:
Hi, i have SQL Server 2005 and a database set that is called, myCompany
the problem is that i cant connect from my page to it,
here is from the web.config: ( i have got this connectionstring from...
|
by: Glen Buell |
last post by:
Hi all,
I have a major problem with my ASP.NET website and it's SQL Server
2005 Express database, and I'm wondering if anyone could help me out
with it.
This site is on a webhost...
|
by: Johnny Jörgensen |
last post by:
Hi all
I just saw an ad in the latest ComponentSource newsletter for a database
engine called VistaDB 3.0.
http://www.vistadb.net/default.asp
It looks very interesting as a database engine...
|
by: AAaron123 |
last post by:
I want to create a database with one table on the host.
I can't user SQL Server Management Studio to do it so I guess I have to do
it programmatically.
I have in mind that in the session start...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |