社区应用 最新帖子 精华区 社区服务 会员列表 统计排行 银行
上一主题下一主题
«12»Pages: 2/2     Go
memoriesoff 离线
级别: 论坛版主
UID: 10
精华: 1
发帖: 387
积分: 844 分
威望: 0 点
贡献: 0 点
爱心: 0 个
好评度: 0 点
在线时间: 215(时)
注册时间: 2009-10-02
最后登录: 2024-12-04
10楼  发表于: 2011-01-13   
获取DataGridView 控件中选中的单元格
获取 DataGridView 控件中选中的单元格

        '显示所指的单元格的值
        'Me.ZHSH_TABLE_DAHDDataGridView.CurrentCell.FormattedValue
        If Me.ZHSH_TABLE_DAHDDataGridView.CurrentCell.FormattedValue <> "" Then
            Form5.Show()
            Form5.ZHSH_MV_SHOPTableAdapter.FillBy(Form5.DataSet1.ZHSH_MV_SHOP, Me.ZHSH_TABLE_DAHDDataGridView.CurrentCell.FormattedValue)
        Else
            Form5.Hide()
        End If
[ 此帖被memoriesoff在2011-01-13 14:49重新编辑 ]
memoriesoff 离线
级别: 论坛版主
UID: 10
精华: 1
发帖: 387
积分: 844 分
威望: 0 点
贡献: 0 点
爱心: 0 个
好评度: 0 点
在线时间: 215(时)
注册时间: 2009-10-02
最后登录: 2024-12-04
11楼  发表于: 2011-01-17   
变量查询
--过程
Namespace DataSet1TableAdapters
    Partial Class ZHSH_MV_SHOPTableAdapter
        Inherits System.ComponentModel.Component
        Public Property SelectCommand() As OracleClient.OracleCommand()
            Get
                If (Me._commandCollection Is Nothing) Then
                    Me.InitCommandCollection()
                End If
                Return Me._commandCollection
            End Get
            Set(ByVal value As OracleClient.OracleCommand())
                Me._commandCollection = value
            End Set
        End Property

        Public Function FillByWhere(ByVal dataTable As DataSet1.ZHSH_MV_SHOPDataTable, ByVal WhereExp As String) As Integer
            Dim stSelect As String
            stSelect = Me._commandCollection(0).CommandText
            Try
                Me._commandCollection(0).CommandText += " WHERE " + WhereExp
                Return Me.Fill(dataTable)
            Catch ex As Exception
            Finally
                Me._commandCollection(0).CommandText = stSelect
            End Try
        End Function
    End Class
End Namespace

--按钮

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim stCustID As String = Trim(TextBox1.Text)
        Dim stShipCntry As String = Trim(TextBox2.Text)
        ' Pass in a SELECT with no WHERE that conforms to the the DataTAble
        ' used by the TableAdapter's DataSet
        Me.ZHSH_MV_SHOPTableAdapter.SelectCommand(0).CommandText = _
        "SELECT * FROM oracle.ZHSH_MV_SHOP"
        ' Build a string containing WHERE criteria (without the WHERE)
        Dim stWhere As String = ""
        If stCustID <> "" Then
            stWhere = "shopid LIKE '" + stCustID + "%' AND "
        End If
        If stShipCntry <> "" Then
            stWhere += "shopname LIKE '" + stShipCntry + "%' "
        Else
            stWhere = Replace(stWhere, " AND ", "")
        End If
        If stWhere = "" Then
            Me.ZHSH_MV_SHOPTableAdapter.Fill(Me.DataSet1.ZHSH_MV_SHOP)
        Else
            Me.ZHSH_MV_SHOPTableAdapter.FillByWhere(Me.DataSet1.ZHSH_MV_SHOP, stWhere)
        End If
    End Sub
[ 此帖被memoriesoff在2011-01-19 09:15重新编辑 ]
memoriesoff 离线
级别: 论坛版主
UID: 10
精华: 1
发帖: 387
积分: 844 分
威望: 0 点
贡献: 0 点
爱心: 0 个
好评度: 0 点
在线时间: 215(时)
注册时间: 2009-10-02
最后登录: 2024-12-04
12楼  发表于: 2011-01-18   
函数
text1满足条件,赋值
        If Len(TextBox1.Text) = 4 Then
            TextBox2.Text = Replace(TextBox1.Text, 0, 9)
        End If
memoriesoff 离线
级别: 论坛版主
UID: 10
精华: 1
发帖: 387
积分: 844 分
威望: 0 点
贡献: 0 点
爱心: 0 个
好评度: 0 点
在线时间: 215(时)
注册时间: 2009-10-02
最后登录: 2024-12-04
13楼  发表于: 2011-01-20   
教程
DataGridView datagridview.rar (26 K) 下载次数:0
memoriesoff 离线
级别: 论坛版主
UID: 10
精华: 1
发帖: 387
积分: 844 分
威望: 0 点
贡献: 0 点
爱心: 0 个
好评度: 0 点
在线时间: 215(时)
注册时间: 2009-10-02
最后登录: 2024-12-04
14楼  发表于: 2011-01-20   
打开一个文件并返回所在路径
           ' 打开一个文件并返回所在路径
        Dim OpenFileDialog1 As New OpenFileDialog
        OpenFileDialog1.Filter = "Excle文件(*.xls)|*.xls"
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            Dim fileName As String = OpenFileDialog1.FileName
            '返回文件所在路径
            TextBox1.Text = OpenFileDialog1.FileName
        End If
上一主题下一主题
«12»Pages: 2/2     Go
快速回复 顶端
内容
HTML 代码不可用
 使用签名
 Wind Code自动转换
 匿名帖
 隐藏此帖
 隐藏附件
 出售
 加密
限 150 字节
验证问题:1+1= 正确答案:2
批量上传需要先选择文件,再选择上传
限 500000 字节
按 Ctrl+Enter 直接提交