Creating multiple labels and adding text in vb.net - vb.net

I have a List of KeyValuePairs where the number of KeyValuePairs changes over time. In a form I need to create a label for each KeyValuePair that contains the Value as the text.
How can I do this?
This is what I have tried...
For Each element In keyvalueP
Dim Label1 As New Label
With Label1
.Width = 512
.Height = 18
.Left = 12
.Text = " Nr. " & i & " - Matchtype " & element.Value.ToString
End With
i = i + 1
Next

I actually manage to find a solution that worked
Private Sub R75Dialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim labelText = ""
Dim i = 0
For Each element In keyvalueP
labelText = " Nr. " & i & " Groupname: " & element.Key.ToString & " - Matchtype " & element.Value.ToString
Dim label As New Label()
Dim count As Integer = Panel1.Controls.OfType(Of Label)().ToList().Count
label.Location = New Point(10, (25 * count) + 2)
label.Size = New Size(1000, 20)
label.Name = "label_" & (count + 1)
label.Text = labelText
Panel1.Controls.Add(label)
i = i + 1
Next
End Sub

Related

Find and highlight the max value in from multiple column in VB.net

Hi i need anyone to help me,
I need to highlight the highest value from multiple column in table
For Ex:-
I have try out some coding..
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
UIUtility = New UIUtility()
Dim dtStartProcessTime As DateTime
Dim dtEndProcessTime As DateTime
Dim dtStartQueryTime As DateTime
Dim dtEndQueryTime As DateTime
Dim tsQueryTime As TimeSpan
Dim tsProcessTime As TimeSpan
Dim strCassList As String = ""
Dim dtDefectInfo As New DataTable
Dim dtDefectList As New DataTable
Dim dtResult As New DataTable
Dim dtSelectDefectInfo As New DataTable
Dim strCass_id As String = ""
Dim dtDisplay As New DataTable
Try
dtStartProcessTime = Now
Me.Title = "Shipping Cassettes List"
Dim sEvent_date As String = Request.QueryString("Event_date").Trim()
Dim sRecipe As String = Request.QueryString("recipe").Trim()
Dim sOperation As String = Request.QueryString("operation").Trim()
Dim sEquipment As String = Request.QueryString("equipment").Trim()
lblStatus.Text = "Event_date:" + sEvent_date + _
"<br>Recipe:" + sRecipe + _
"<br>Operation:" + sOperation + _
"<br>Equipment:" + sEquipment + _
"<br><br>"
Dim dtCass As DataTable
Dim drNew As DataRow
Dim SelectDefectInfo As DataRow()
dtStartQueryTime = Now
dtCass = UIUtility.RetrieveShipCassette(sEvent_date, sRecipe, sOperation, sEquipment)
If dtCass.Rows.Count > 0 Then
strCassList = UIUtility.ReturnStringFromdt(dtCass, "shipping_cass_id")
dtDefectInfo = UIUtility.RetrieveDefectInfo(strCassList)
dtDefectList = UIUtility.dtView(dtDefectInfo, "defect")
dtResult.Columns.Add("cass_id", Type.GetType("System.String"))
For i = 0 To dtDefectList.Rows.Count - 1
If Not (dtDefectList.Rows(i).Item("defect").ToString().Equals("NON")) Then
dtResult.Columns.Add(dtDefectList.Rows(i).Item("defect"), Type.GetType("System.Int32")).DefaultValue = 0
End If
Next
For i = 0 To dtCass.Rows.Count - 1
drNew = dtResult.NewRow
strCass_id = dtCass.Rows(i).Item("shipping_cass_id")
drNew("cass_id") = dtCass.Rows(i).Item("cass_id")
SelectDefectInfo = dtDefectInfo.Select("dest_cass_id = '" + strCass_id + "'")
dtSelectDefectInfo = New DataTable
If SelectDefectInfo.Count > 0 Then
dtSelectDefectInfo = SelectDefectInfo.CopyToDataTable
For j = 0 To dtSelectDefectInfo.Rows.Count - 1
If Not (dtSelectDefectInfo.Rows(j).Item("defect").ToString().Trim().Equals("NON")) Then
drNew(dtSelectDefectInfo.Rows(j).Item("defect").ToString()) = dtSelectDefectInfo.Rows(j).Item("defect_count").ToString()
End If
Next
End If
dtResult.Rows.Add(drNew)
Next
End If
dtEndQueryTime = Now
tsQueryTime = dtEndQueryTime.Subtract(dtStartQueryTime)
'For i As Integer = 0 To dtCass.Rows.Count - 1
' drDisplay = dtDisplay.NewRow
' drDisplay("cass_id") = dtCass.Rows(i)("cass_id").ToString()
' dtDisplay.Rows.Add(drDisplay)
' 'dtCass.Rows(i).Item(
'Next
'e.Row.BorderWidth = 2
dgSummary.DataSource = Nothing
dgSummary.DataSource = dtResult
dgSummary.DataBind()
lblStatus.Text += "Total " + dtResult.Rows.Count.ToString + " rows of data found."
dtEndProcessTime = Now
tsProcessTime = dtEndProcessTime.Subtract(dtStartProcessTime)
lblProcessingTime.Text = "Processing Time: " + tsProcessTime.TotalSeconds.ToString + " Secs (Query Time: " + tsQueryTime.TotalSeconds.ToString + " Secs)"
For Each r As GridViewRow In dtResult.Rows()
Dim max As Integer = Integer.MinValue
For i = 1 To r.Cells.Count - 1
Dim n As Integer
If Integer.TryParse(CType(r.Cells(i).Text, String), n) Then max = Math.Max(n, max)
Next
For i = 1 To r.Cells.Count - 1
If r.Cells(i).Text = max Then
r.Cells(i).BackColor = Drawing.Color.Orange
Exit For
End If
Next
Next
Catch ex As Exception
lblMessage.Text = "An error occured:" + ex.Message + " Please contact your administrator."
MyLog.WriteToLog(Me.GetType().Name(), System.Reflection.MethodInfo.GetCurrentMethod().Name, "Exception occured." & vbCrLf & "Error Message:" & ex.Message & vbCrLf & " StackTrace:" & ex.StackTrace)
End Try
End Sub
Protected Sub dgSummary_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles dgSummary.RowDataBound
Dim cass_id As String = ""
'Dim dtResult As New DataTable
'Dim DataGridView1 As New DataTable
Dim dtCass As New DataTable
If e.Row.RowType = DataControlRowType.DataRow Then
cass_id = e.Row.Cells(0).Text.Trim
If Not e.Row.Cells(0).Text.Trim.Equals("") Then
e.Row.Cells(0).Attributes.Add("Title", "Click and view the cassette details")
e.Row.Cells(0).Attributes("onmouseover") = "this.style.color='DodgerBlue';this.style.cursor='hand';"
e.Row.Cells(0).Attributes("onmouseout") = "this.style.color='Black';"
e.Row.Cells(0).Attributes("onClick") = _
String.Format("window.open('{0}','_blank','scrollbars=yes,status=yes,location=yes,toolbar=yes,menubar=yes,resizable=Yes')", _
ResolveUrl(System.Configuration.ConfigurationManager.AppSettings("SFEHReportLink_SSL") + cass_id))
e.Row.Cells(0).Style("cursor") = "pointer"
End If
End Sub
Maybe theres any coding that more easier than this since i have 17items
Thank you so much for you guys help.
After i add the new code, i got this error,
new error
maybe this example can help you
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
For Each r As DataGridViewRow In DataGridView1.Rows
Dim max As Integer = Integer.MinValue
For i = 1 To r.Cells.Count - 1
Dim n As Integer
If Integer.TryParse(CType(r.Cells(i).Value, String), n) Then max = Math.Max(n, max)
Next
For i = 1 To r.Cells.Count - 1
If r.Cells(i).Value = max Then
r.Cells(i).Style.BackColor = Color.Orange
Exit For
End If
Next
Next
End Sub

How do I get the Custom X Values on the Chart Areas when I use my mouse on the chart

I am making a chart on reports and my problem is how can I get the x values(Custom Values of Chart Areas) of my chart when I move my mouse on the chart(annotation)?
I already did this for the past 2 days and I still don't get on how should I get the x values of the chart. I tried using the codes related on charts but I still don't get the desired result
Private Sub cmdGenChart_Click(sender As Object, e As EventArgs) Handles cmdGenChart.Click
Access.AddParam("#dt1", DateTimePicker1.Value.AddDays(-1).ToString)
Access.AddParam("#dt2", DateTimePicker2.Value.ToString)
Access.ExecQuery("SELECT [Flood_ID], [Flood_Level], [Flood_Time], [Flood_Date] " & _
"FROM WaterLevel " & _
"WHERE [Flood_Date] BETWEEN #dt1 AND #dt2 " & _
"ORDER BY [Flood_ID] ASC")
Dim checkDate As DateTime = DateTimePicker1.Value
For Each r As DataRow In Access.dt.Rows
Chart1.ChartAreas(0).AxisX.CustomLabels.Add(Counter - 1, Counter + 1, r("Flood_Time"))
Chart1.Series("Water Level").Points.AddXY(Counter, r("Flood_Level"))
Counter += 1
Next
Dim PC As New CalloutAnnotation
With PC
Chart1.Annotations.Add(PC)
End With
End Sub
Private Sub Chart1_MouseMove(sender As Object, e As MouseEventArgs) Handles Chart1.MouseMove
Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)
If result.ChartElementType = ChartElementType.DataPoint Then
Chart1.Series(0).Points(result.PointIndex).XValue.ToString()
Dim thisPt As New PointF(CSng(Chart1.Series(0).Points(result.PointIndex).XValue),
CSng(Chart1.Series(0).Points(result.PointIndex).YValues(0)))
Dim ta As New CalloutAnnotation
With ta
.AnchorDataPoint = Chart1.Series(0).Points(result.PointIndex)
.Text = "Water Level: " & thisPt.Y.ToString & vbCrLf & "Time: " & DateTime.FromOADate(thisPt.X).ToShortTimeString
If thisPt.Y.ToString <= 20 And thisPt.Y Then
.ForeColor = Color.Green
.Font = New Font("Tahoma", 10, FontStyle.Bold)
ElseIf thisPt.Y.ToString <= 60 Then
.ForeColor = Color.Orange
.Font = New Font("Tahoma", 10, FontStyle.Bold)
ElseIf thisPt.Y.ToString > 60 Then
.ForeColor = Color.Red
.Font = New Font("Tahoma", 10, FontStyle.Bold)
End If
End With
Chart1.Annotations(0) = ta
Chart1.Invalidate()
End If
End Sub
What I want is that the value of Time is equal to the value of the corresponding x value below it.
On the image:
Water Level: 15
Time: 12:00 AM
Desired Result:
Water Level: 15
Time: 6:21 AM
http://prntscr.com/m0p4xb
After so many thinking, the solution I found is to set my counter to be equal to the value of my primary keys on the database and set it that it will be bonded on the chart then I will only load it on my SQL commands and that did the trick.
Global variable
Dim counter as Double = 1
The generate chart button
Private Sub cmdGenChart_Click(sender As Object, e As EventArgs) Handles cmdGenChart.Click
Access.AddParam("#dt1", DateTimePicker1.Value.AddDays(-1).ToString)
Access.AddParam("#dt2", DateTimePicker2.Value.ToString)
Access.ExecQuery("SELECT [Flood_ID], [Flood_Level], [Flood_Time], [Flood_Date] " & _
"FROM WaterLevel " & _
"WHERE [Flood_Date] BETWEEN #dt1 AND #dt2 " & _
"ORDER BY [Flood_ID] ASC")
For Each r As DataRow In Access.dt.Rows
Counter = r("Flood_ID")
Chart1.ChartAreas(0).AxisX.CustomLabels.Add(Counter - 1, Counter + 1, r("Flood_Time"))
Chart1.Series("Water Level").Points.AddXY(Counter, r("Flood_Level"))
Counter += 1
Next
Dim PC As New CalloutAnnotation
With PC
Chart1.Annotations.Add(PC)
End With
End Sub
The chart mouse move
Private Sub Chart1_MouseMove(sender As Object, e As MouseEventArgs) Handles Chart1.MouseMove
Dim result As HitTestResult = Chart1.HitTest(e.X, e.Y)
If result.ChartElementType = ChartElementType.DataPoint Then
Chart1.Series(0).Points(result.PointIndex).XValue.ToString()
Access.AddParam("#pos", Chart1.Series(0).Points(result.PointIndex).XValue)
Access.AddParam("#level", Chart1.Series(0).Points(result.PointIndex).YValues(0))
Access.ExecQuery("SELECT [Flood_ID], [Flood_Level], [Flood_Time] " & _
"FROM WaterLevel " & _
"WHERE [Flood_ID] = #pos AND [Flood_Level] = #level ")
Dim r As DataRow = Access.dt.Rows(0)
Dim ta As New CalloutAnnotation
With ta
.AnchorDataPoint = Chart1.Series(0).Points(result.PointIndex)
.Text = "Water Level: " & r("Flood_Level") & vbCrLf & "Time: " & r("Flood_Time")
End With
Chart1.Annotations(0) = ta
Chart1.Invalidate()
End If
End Sub
This is the result:
http://prntscr.com/m2xpnf

#XVAL shows data index (integer) instead of string of an array

I want to know why #XVAL shows the index (from 0 to 3 since there is 4 items in there) instead of ex:"< .50%" and so on. This will help me to change the desired output, which is "< .50%".
I've tried #AXISLABEL too and it doesn't work.
Here is a snippet of the code:
Private Sub LoadGraphicChart()
Try
C1Chart2.ChartGroups(0).ChartData.SeriesList.Clear()
' Data
Dim items As String() = New String() {"< 0.50%", "0.50% - 1.00%", "1.00% - 2.00%", "> 2.00%"}
Dim unitHData As Double() = New Double() {7 / 100, 0, 0, 1 / 100}
'first try, populating the series
Dim unitH As C1.Win.C1Chart.ChartDataSeriesCollection = C1Chart2.ChartGroups(0).ChartData.SeriesList
'unitH.Clear()
Dim series As ChartDataSeries = unitH.AddNewSeries
series.Label = "Unit Holder"
series.LineStyle.Color = Color.MediumPurple
series.X.CopyDataIn(items)
series.Y.CopyDataIn(unitHData)
'tooltip
C1Chart2.ToolTip.Enabled = True
For Each ds As ChartDataSeries In unitH
ds.TooltipText = "Series = {#TEXT}" + ControlChars.Cr + ControlChars.Lf + "X = {#XVAL}" + ControlChars.Cr + ControlChars.Lf + "Y = {#YVAL:0.00%}"
Next ds
End Try
End Sub
This is what the tooltip currently looks like:
Changing from using tooltiptext to CoordToDataIndex solved my problems.
Here is how I use it:
Private Sub C1Chart2_MouseClick(sender As Object, e As MouseEventArgs) Handles C1Chart2.MouseClick
Dim SeriesOutput As Integer
Dim PointOutput As Integer
Dim DistanceOutput As Integer
Dim items As String() = New String() {InputLabel10.Text, InputLabel9.Text, InputLabel8.Text, InputLabel7.Text}
Dim unitHData As String() = New String() {FormatPercent((CDbl(lblPersen00.Text) / 100)), FormatPercent((CDbl(lblPersen05.Text) / 100)), FormatPercent((CDbl(lblPersen10.Text) / 100)), FormatPercent((CDbl(lblPersen20.Text) / 100))}
C1Chart2.ChartGroups.Group0.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, SeriesOutput, PointOutput, DistanceOutput)
Debug.WriteLine("Series Index : " & SeriesOutput.ToString())
Debug.WriteLine("Point Index : " & PointOutput.ToString())
Debug.WriteLine("Distance from Point: " & DistanceOutput.ToString())
'MessageBox.Show(PointOutput)
If PointOutput.ToString <> "" Then
MessageBox.Show("X : " & items(PointOutput) & ControlChars.Cr & ControlChars.Lf & "Y : " & unitHData(PointOutput))
End If
End Sub
Result(First Data):
Result(Last Data):

How to update a Progressbar / Label created per code in a for each loop?

First my code :
Sub festplatte()
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
Dim I As Integer
For Each d In allDrives
If d.IsReady = True Then
Try
' Intelize controls
Dim progressbar As ProgressBar = New ProgressBar
Dim pbgroup As GroupBox = New GroupBox
Dim info As Label = New Label
Dim type As Label = New Label
Dim format As Label = New Label
Dim Space As Double = d.TotalFreeSpace / d.TotalSize
' Add to tab
Me.Tab_M.Controls.Add(progressbar)
Me.Tab_M.Controls.Add(pbgroup)
Me.Tab_M.Controls.Add(info)
Me.Tab_M.Controls.Add(type)
Me.Tab_M.Controls.Add(format)
' Add to group
pbgroup.Controls.Add(progressbar)
pbgroup.Controls.Add(info)
pbgroup.Controls.Add(type)
pbgroup.Controls.Add(format)
pbgroup.Text = d.Name & " | Name : " & CheckName(d.VolumeLabel.ToString())
pbgroup.Size = New System.Drawing.Size(600, 65)
pbgroup.Location = New System.Drawing.Point(8, I * 70 + 40)
' format
format.AutoSize = True
format.Name = "format" & I
format.Location = New System.Drawing.Point(435, 36)
format.Text = "Format : " & d.DriveFormat
' Typ
type.AutoSize = True
type.Name = "type" & I
type.Location = New System.Drawing.Point(435, 16)
type.Text = "Art : " & GetDriverFormat(d)
' info
info.Name = "info" & I
info.Location = New System.Drawing.Point(6, 16)
info.AutoSize = True
' Info Text :: 1000 MB Grenze
If d.TotalFreeSpace > Math.Pow(1024, 3) Then
info.Text = "Benutzter Speicher beträgt : " & Math.Round((d.TotalSize - d.TotalFreeSpace) / btogb, 2) & " GB von " & Math.Round((d.TotalSize) / btogb, 2) & " GB (" & Math.Round(100 - Space * 100, 2) & " % )"
Else
info.Text = "Benutzter Speicher beträgt : " & Math.Round((d.TotalSize - d.TotalFreeSpace) / btomb, 2) & " MB von " & Math.Round((d.TotalSize) / btomb, 2) & " MB (" & Math.Round(100 - Space * 100, 2) & " % )"
End If
'Progressbar
progressbar.Size = New System.Drawing.Size(425, 23)
progressbar.Location = New System.Drawing.Point(6, 32)
progressbar.Name = "Memory" & I
progressbar.Value = 100 - Space * 100
Catch ex As Exception
MsgBox(ex.ToString())
End Try
I += 1
End If
Next
End Sub
The code does generate a groupbox with each a progressbar in it and 3 labels, where i would like to edit something.
How can I edit the text of for example a label ? And how could I add / remove generated elements from the form ? I tried with refresh but it doesnt work
The Form
This was something quick I tried:
Dim LabelList As New List(Of Integer)
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim LBL As New Label
LBL.Location = New Point(6, 23)
LBL.AutoSize = True
Me.Controls.Add(LBL)
LabelList.Add(Me.Controls.Count - 1)
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Me.Controls(LabelList(0)).Text = "HELLO WORLD!"
End Sub
This will add a label to the form and then add it's control index to LabelList. LabelList(0) will get the index for the first added label.

Printing Records from ODBC Connection - Stuck on First Page

I am printing records from an ODBC connection but I am not able to print more than the first page. The code I have below generates multiple copies of the same first page. How can I iterate through my records and still create page breaks when necessary?
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
'MsgBox("Printing functionality is still under construction.", MsgBoxStyle.Information)
Dim RecordDoc As Drawing.Printing.PrintDocument
RecordDoc = New Drawing.Printing.PrintDocument
With RecordDoc.DefaultPageSettings
.Landscape = False
.Margins.Left = 50
.Margins.Right = 50
.Margins.Top = 50
.Margins.Bottom = 50
End With
RecordDoc.DocumentName = "Print Records"
AddHandler RecordDoc.PrintPage, AddressOf Me.printrecords
dlgPreview.Document = RecordDoc
dlgPreview.ShowDialog()
RecordDoc.Dispose()
End Sub
Private Sub PrintRecords(ByVal sender As Object, ByVal e As Drawing.Printing.PrintPageEventArgs)
Dim lvi As ListViewItem
Dim Conn As OdbcConnection
Dim Reader As OdbcDataReader
Dim strFname As String = ""
Dim strLname As String = ""
Dim strReportHdr As String = ""
Dim strMainCategory As String = ""
Dim strColumnHeader As String = ""
Dim intLinesPerPage As Integer = 0
Dim x, y As Single
Dim myfont As Font = New Font("Arial", 12, FontStyle.Regular)
Dim myPen As New Pen(Color.Black, 3)
'DEFINE THE REPORT HEADER BASED ON LISTVIEW SELECTIONS
'FIRST, GET THE COLUMN NUMBER SELECTED. YOU'LL USE THIS FOR THE REPORT HEADER AS WELL AS WHEN PRINTING DATA
Dim PrintColHeader As ColumnHeader = ListView1.Columns(intLViewColSort)
'REMOVE THE < OR > AS NECESSARY, IF PRESENT
If PrintColHeader.Text.StartsWith("> ") Then
strColumnHeader = Mid(PrintColHeader.Text, 3) & ", in descending order"
ElseIf PrintColHeader.Text.StartsWith("< ") Then
strColumnHeader = Mid(PrintColHeader.Text, 3) & ", in ascending order"
End If
If rdoCustInfo.Checked = True Then
strMainCategory = "Customer Information"
ElseIf rdoCustVendPrefs.Checked = True Then
strMainCategory = "Customer Vendor Preferences"
ElseIf rdoPricePts.Checked = True Then
strMainCategory = "Customer Price Points"
ElseIf rdoSalesHist.Checked = True Then
strMainCategory = "Customer Sales History"
ElseIf rdoSpecific.Checked = True Then
strMainCategory = "Other"
Else
MsgBox("System error with print function. Have a glass of wine.", MsgBoxStyle.Critical)
Exit Sub
End If
y = e.MarginBounds.Y
x = e.MarginBounds.X
e.Graphics.DrawRectangle(myPen, e.MarginBounds.X, e.MarginBounds.Y + 20, 500, 1)
e.Graphics.DrawString(strMainCategory & " - " & strColumnHeader, myfont, Brushes.Black, x, y)
y += CInt(2 * myfont.GetHeight(e.Graphics))
myfont = New Font("Arial", 10, FontStyle.Regular)
intLinesPerPage = e.MarginBounds.Height / myfont.GetHeight(e.Graphics)
'Open Connection TO ASC
Conn = New OdbcConnection(ConnString)
Conn.Open()
For Each lvi In ListView1.Items
'Execute Query
cmdString = "select lastname,firstname,street1,street2,city,state,zipcode,phonenum,emailaddress from customer where customernum=" & lvi.Text
Dim Cmd As New OdbcCommand(cmdString, Conn)
Reader = Cmd.ExecuteReader()
'Process The Result Set
While (Reader.Read())
Dim tempy As Integer
tempy = y
Dim CustName As String = Trim(Reader("firstname")) & " " & Trim(Reader("lastname"))
CustName = StrConv(CustName, VbStrConv.ProperCase)
e.Graphics.DrawString(CustName, myfont, Brushes.Black, e.MarginBounds.X, y)
y += CInt(myfont.GetHeight(e.Graphics))
Dim street As String = ""
If Trim(Reader("street2").ToString) <> "" And Not (IsDBNull(Reader("street2"))) Then
street += Trim(Reader("street1").ToString) & vbCrLf & Trim(Reader("street2"))
Else
street += Trim(Reader("street1").ToString)
End If
street = StrConv(street, VbStrConv.ProperCase)
e.Graphics.DrawString(street, myfont, Brushes.Black, e.MarginBounds.X, y)
y += CInt(myfont.GetHeight(e.Graphics))
Dim CityStateZip As String = ""
CityStateZip = StrConv(Trim(Reader("city")), VbStrConv.ProperCase) & ", " & Trim(Reader("state")) & ", " & Reader("zipcode")
e.Graphics.DrawString(CityStateZip, myfont, Brushes.Black, e.MarginBounds.X, y)
x += 200
e.Graphics.DrawString(Trim(Reader("phonenum")), myfont, Brushes.Black, x, tempy)
tempy += CInt(myfont.GetHeight(e.Graphics))
y += CInt(2 * myfont.GetHeight(e.Graphics))
e.Graphics.DrawString(Trim(Reader("emailaddress")), myfont, Brushes.Black, x, tempy)
x = e.MarginBounds.X
'If intPrintLineCount1 > intLinesPerPage Then
' e.HasMorePages = True
' intPrintLineCount1 = 0
'Else
' e.HasMorePages = False
'End If
If y + myfont.Height > e.MarginBounds.Bottom Then
e.HasMorePages = True
End If
'intPrintLineCount1 += 10
End While
Cmd.Dispose()
Next
Reader.Close()
Conn.Close()
Conn.Dispose()
End Sub