如何填充此tableAdapter的详细信息视图 [英] How do I populate The detail view for this tableAdapter

查看:93
本文介绍了如何填充此tableAdapter的详细信息视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用此代码时遇到问题,有人可以提供帮助吗?

I have been having trouble with this code, can anyone help?

Option Strict On
Imports System.IO
Public Class reviewOrdersForm
    Friend Structure orderData
        Dim orderNumber As String
        Dim customerID As String
        Dim phoneModel As String
        Dim price As String
        Dim quantity As String
    End Structure
    Dim totOrderAmnt As Decimal
    Dim numElems As Integer
    Dim customerIDInteger As Integer
    Friend orders(5000) As orderData
    Private Sub reviewOrdersForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'CustomerDataSet.Customer' table. You can move, or remove it, as needed.
        Dim recordString As String
        Dim field(4) As String
        Try
            Dim orderFile As New StreamReader("PhoneOrders.txt")
            ' read file and populate listBox
            Do Until orderFile.Peek = -1 Or numElems > 5000
                recordString = orderFile.ReadLine()
                field = Split(recordString, ",")
                With orders(numElems)
                    .orderNumber = field(0)
                    .customerID = field(1)
                    .phoneModel = field(2)
                    .price = field(3)
                    .quantity = field(4)
                End With
                ListBox1.Items.Add(orders(numElems).orderNumber)
                numElems += 1
            Loop
            orderFile.Close()
            If ListBox1.SelectedIndex > -1 Then
                Me.CustomerTableAdapter.FillByCustomerID(Me.CustomerDataSet.Customer, CInt(orders(ListBox1.SelectedIndex).customerID.ToString))
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message, "File problems")
        End Try
    End Sub
End Class

推荐答案

这篇关于如何填充此tableAdapter的详细信息视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆