我的代碼有問題;並希望得到一些幫助,讓她做我想做的事情而不會產生惱人的錯誤。閱讀數據綁定列表框字符串,找到用戶選擇的字符串並將所述字符串寫入文件。我需要知道如何避免vb 2010中的System.Data.DataRowview
Private Sub btnContinue_Click(sender As System.Object, e
As System.EventArgs) Handles btnContinue.Click
' 1st file and mySQL Update to testing table
If txtLocation.Text.ToString <> "" And txtUnitTested.Text.ToString <> "" Then
Dim filewriter As New System.IO.StreamWriter(
"C:\Users\OER\Documents\Visual Studio 2010\Projects\frmTest1_0.txt")
Dim curItem = lstCustomer.SelectedItem
Dim now As DateTime = DateTime.Now
With filewriter
.WriteLine(vbCrLf + (now.ToString("F"))) ' Write the DateTime to the file
End With
For Each objDataRowView As DataRowView In lstCustomer.SelectedItems
Dim item As String
For Each item As DataRowView In Me.lstCustomer.Items.Item("customer")
item = String.Parse(lstCustomer.SelectedValue)
WriteLine(curItem(item))
Next item
Next ' THIS IS THE FOR LOOP I AM HAVING ISSUES WITH!!!!!!!
With filewriter
.WriteLine(vbCrLf + txtLocation.Text + vbCrLf + txtUnitTested.Text)
End With
filewriter.Close()
frmTest1.Show()
Else
MsgBox("Please Type the Location and Unit Tested!!!", vbCritical)
txtLocation.Clear()
txtUnitTested.Clear()
txtLocation.Focus()
End If
你會得到什麼「煩人的錯誤」?我懷疑它是'HavingIssueException'。 – 2013-02-27 20:23:49
沒有先生,這是邏輯錯誤(該程序將System.Data.DataView添加到我的數據庫中) – mauritaniawashin 2013-02-27 20:38:12
就好像列表框中的數據需要單獨聲明或與數據綁定列表一起聲明,可以這麼說 – mauritaniawashin 2013-02-27 20:45:10