标题: VB.NET 求助啊! [打印本页] 作者: ~美妹一號~ 时间: 2013-7-18 11:34 AM 标题: VB.NET 求助啊! 本帖最后由 ~美妹一號~ 于 2013-7-18 11:37 AM 编辑
我的error是Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
read database 然后拿资料出来做print receipt~可是。。一直出现这个问题。求助啊!! 作者: tomiverson 时间: 2013-7-18 12:07 PM
可以把你中error的code放出来看看吗?作者: ~美妹一號~ 时间: 2013-7-18 07:49 PM
Imports System.IO
Imports System.Data.OleDb
Public Class frmPrintCash
Dim ListDetails As ListViewItem
Dim countReceipt As Integer
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;data source=SS Snow.accdb")
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim printFont As New Font("Cambria", 17, FontStyle.Regular)
Dim headingFont As New Font("Cambria", 18, FontStyle.Bold)
Dim sngLineHeight As Single = printFont.GetHeight + 2
Dim sngXLocation As Single = e.MarginBounds.Left
Dim sngYLocation As Single = e.MarginBounds.Top
' set up detail
For i As Integer = 0 To lvwProduct.Items.Count - 1
e.Graphics.DrawString(lvwProduct.Items(i).Text & vbTab & vbTab & lvwProduct.Items(i).SubItems(1).Text & vbTab & lvwProduct.Items(i).SubItems(2).Text, printFont, Brushes.DimGray, sngXLocation, sngYLocation)
sngYLocation += sngLineHeight
Next
Private Sub frmPrintCash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'SS_SnowDataSet.Receipt_Item' table. You can move, or remove it, as needed.
Me.Receipt_ItemTableAdapter.Fill(Me.SS_SnowDataSet.Receipt_Item)
'TODO: This line of code loads data into the 'SS_SnowDataSet.Receipt' table. You can move, or remove it, as needed.
Me.ReceiptTableAdapter.Fill(Me.SS_SnowDataSet.Receipt)
'Dim ReceiptID As StreamReader
'ReceiptID = New StreamReader("ReceiptNo.txt")
For x As Integer = 0 To SS_SnowDataSet.Receipt_Item.Rows.Count - 1
If txtReceiptNo.Text = SS_SnowDataSet.Receipt_Item.Rows(x).Item(0) Then
ListDetails = lvwProduct.Items.Add(SS_SnowDataSet.Receipt_Item(x).Item(2))
ListDetails.SubItems.Add(SS_SnowDataSet.Receipt_Item(x).Item(3))
ListDetails.SubItems.Add(SS_SnowDataSet.Receipt_Item(x).Item(4))
End If
Next x
For w As Integer = 0 To SS_SnowDataSet.Receipt.Rows.Count - 1
If txtReceiptNo.Text = SS_SnowDataSet.Receipt.Rows(w).Item(0) Then
lblAmount.Text = SS_SnowDataSet.Receipt.Rows(w).Item(1)
lblDiscount.Text = SS_SnowDataSet.Receipt.Rows(w).Item(2)
lblDeliveryFee.Text = SS_SnowDataSet.Receipt.Rows(w).Item(3)
lblTotal.Text = SS_SnowDataSet.Receipt.Rows(w).Item(4)
lblPaid.Text = SS_SnowDataSet.Receipt.Rows(w).Item(5)
lblBalance.Text = SS_SnowDataSet.Receipt.Rows(w).Item(6)
End If
Next w
End Sub
Private Sub ReceiptBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.ReceiptBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.SS_SnowDataSet)
End Sub
End Class作者: ~美妹一號~ 时间: 2013-7-18 07:51 PM