以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  指定行问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132136)

--  作者:ezilu
--  发布时间:2019/3/14 18:03:00
--  指定行问题
大大,我利用窗体
button click 触发  AddNew() 事件
但是怎么样做到 数据添加成功后,它的.current 是在这行数据上面呢

--  作者:有点甜
--  发布时间:2019/3/14 18:11:00
--  

1、tables("").addnew,默认就是把焦点移过去的;

 

2、如果新增要引用,请这样 dim r = tables("").addnew


--  作者:ezilu
--  发布时间:2019/3/14 19:52:00
--  
我这段代码  没有把焦点聚焦在新增行上面  要怎么该,大大
谢谢麻烦

\'\'\'
Dim xm As String = e.Form.Controls("xm").Value
Dim xb As String = e.Form.Controls("xb").Value
Dim nl As Integer = e.Form.Controls("nl").Value
Dim zyh As Integer = e.Form.Controls("zyh").Value
Dim dsa As String = e.Form.Controls("dsa").Value
Dim bq As String = e.Form.Controls("bq").Value
Dim ch As String = e.Form.Controls("ch").Value
Dim ssfl As String = e.Form.Controls("ssfl").Value
Dim gmlczd As String = e.Form.Controls("gmlczd").Value
Dim nxglczd As String = e.Form.Controls("nxglczd").Value
Dim wzlczd As String = e.Form.Controls("wzlczd").Value
Dim gmsslx As String = e.Form.Controls("gmsslx").Value
Dim nxgsslx As String = e.Form.Controls("nxgsslx").Value
Dim wzsslx As String = e.Form.Controls("wzsslx").Value
Dim jdsj As WinForm.DateTimePicker
jdsj = e.Form.Controls("jdsj")
Dim rdo1 As WinForm.RadioButton
Dim rdo2 As WinForm.RadioButton
rdo1 = e.Form.Controls("rdo1")
rdo2 = e.Form.Controls("rdo2")


If xm = "" Then
    MessageBox.Show("姓名为空")
ElseIf xb = "" Then
    MessageBox.Show("性别为空")
ElseIf nl = Nothing Then
    MessageBox.Show("年龄为空")
ElseIf zyh = Nothing Then
    MessageBox.Show("住院号为空")
ElseIf dsa = "" Then
    MessageBox.Show("DSA号为空")
ElseIf bq = "" Then
    MessageBox.Show("病区为空")
ElseIf ch = "" Then
    MessageBox.Show("床号为空")
ElseIf ssfl = "" Then
    MessageBox.Show("手术分类为空")
ElseIf jdsj.Value Is Nothing Then
    MessageBox.Show("建档时间为空")
Else
    Dim dr As DataRow
    dr = DataTables("ssxx").Find("[zyh] = \'" & zyh & "\' ")
    If dr Is Nothing Then
        dr = DataTables("ssxx").AddNew()
        dr("Name") = xm
        dr("sex") = xb
        dr("Age") = nl
        dr("zyh") = zyh
        dr("DSA") = dsa
        dr("bq") = bq
        dr("Bed") = ch
        If ssfl = "冠脉介入" Then
            dr("lczd") = gmlczd
        End If
        If ssfl = "脑血管介入" Then
            dr("lczd") = nxglczd
        End If
        If ssfl = "外周介入" Then
            dr("lczd") = wzlczd
        End If
        If ssfl = "冠脉介入" Then
            dr("sslx") = gmsslx
        End If
        If ssfl = "脑血管介入" Then
            dr("sslx") = nxgsslx
        End If
        If ssfl = "外周介入" Then
            dr("sslx") = wzsslx
        End If
        If rdo1.Checked = True Then
            dr("sfjz") = True
        Else
            dr("sfjz") = False
        End If
        dr("sssj") = jdsj.Value
        
        DataTables.Save()
        
    Else
        MessageBox.Show("住院号存在,请重新输入住院号!", "提示")
    End If
    
End If
[此贴子已经被作者于2019/3/14 19:52:17编辑过]

--  作者:ezilu
--  发布时间:2019/3/14 20:46:00
--  
已经解决 谢谢