datagrid 的又一困惑解决

这几天正忙着做一个平台,又一次用到了DATAGRID,不过这次对它的要求高了些,我想把它显示的一个动态的表(查询结果)中的任何一个ITEM 的详细信息显示在同一个叶面上。当然可以对其显示的详细信息的各项进行编辑等操作。下面是电击SELECT的按钮时的原代码。

 DataGrid1.SelectedIndex = e.Item.ItemIndex '叶面上的值0~pagesize-1
        Dim itemIndex As Integer
        itemIndex = DataGrid1.SelectedIndex + DataGrid1.CurrentPageIndex * DataGrid1.PageSize '拿当前datagrid中的数据的index
        If itemIndex < 0 Then
            itemIndex = 0
        End If
        If e.CommandName.ToLower = "select" Then
            Dim ta As DataTable
            ta = getmember() '绑定数据getmember() 是我定义的一个从数据库中拿满足条件的ITEM

            If Not IsDBNull(ta.Rows(itemIndex)("index")) Then显示你想看的任何一天记录的详细信息
                index.Text = CStr(ta.Rows(itemIndex)("index"))
            End If

            If Not IsDBNull(ta.Rows(itemIndex)("userid")) Then
                userid.Text = CStr(ta.Rows(itemIndex)("userid"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("password")) Then
                password.Text = CStr(ta.Rows(itemIndex)("password"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("country")) Then
                country.Text = CStr(ta.Rows(itemIndex)("country"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("address")) Then
                address.Text = CStr(ta.Rows(itemIndex)("address"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("province")) Then
                province.Text = CStr(ta.Rows(itemIndex)("province"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("tel1")) Then
                tel1.Text = CStr(ta.Rows(itemIndex)("tel1"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("tel2")) Then
                tel2.Text = CStr(ta.Rows(itemIndex)("tel2"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("mobile")) Then
                mobile.Text = CStr(ta.Rows(itemIndex)("mobile"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("email")) Then
                email.Text = CStr(ta.Rows(itemIndex)("email"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("contact_person")) Then
                contracter.Text = CStr(ta.Rows(itemIndex)("contact_person"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("website")) Then
                website.Text = CStr(ta.Rows(itemIndex)("website"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("company")) Then
                company.Text = CStr(ta.Rows(itemIndex)("company"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("fax")) Then
                fax.Text = CStr(ta.Rows(itemIndex)("fax"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("member_type")) Then
                membertype.Text = CStr(ta.Rows(itemIndex)("member_type"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("member_type")) Then
                membertype.Text = CStr(ta.Rows(itemIndex)("member_type"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("member_type")) Then
                membertype.Text = CStr(ta.Rows(itemIndex)("member_type"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("last_modify_datetime")) Then
                modifytime.Text = CStr(ta.Rows(itemIndex)("last_modify_datetime"))
            End If
            If Not IsDBNull(ta.Rows(itemIndex)("reg_datetime")) Then
                regtime.Text = CStr(ta.Rows(itemIndex)("reg_datetime"))
            End If

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值