以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助 rows 转 String  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101468)

--  作者:jackyfashion
--  发布时间:2017/5/31 23:41:00
--  求助 rows 转 String

老师:

您好!

Dim r As Table = Tables("表A")
Dim dlg As New OpenFileDialog
Dim piv As WinForm.PictureViewer = e.Form.Controls("ltsu")
dlg.Filter= "图形文件|*.*"
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
    For Each file As String In dlg.FileNames
        r.AddNew
        Dim tt As Table = Tables("yywrkhtc")
        Dim lt17 = tt(17)("khtc") & "\\"
        Dim pth As String = lt17
        If file.ToLower.StartsWith(pth.ToLower) Then \'如果文件来自Attachments目录
            piv.AddFile(file.SubString(pth.Length))
        Else
            r.Rows("图像") = r.Rows("编号") & ".jpg"            \'编号是String
            FileSys.CopyFile(dlg.FileName,lt17 & r("ltsu"),True)
        End If
    Next
End If

 

错误提示

编译错误:没有为类型 "row" 和 "string 定义运算符 "&"

错误代码: r.Rows("图像") = r.Rows("编号") & ".jpg"

请求老师指教!!!

谢谢!!!

[此贴子已经被作者于2017/5/31 23:47:34编辑过]

--  作者:jackyfashion
--  发布时间:2017/6/1 1:00:00
--  

老师:

   您好!

如果把动态控件添加到动态控件上

把"TextBox"动态添加在动态"panel控件上

Dim s As Integer = Tables("qrymyf").rows.count - 1

For  i As Integer = 0 To s
    Dim pan As WinForm.Panel = e.Form.CreateControl("Panel" & i, ControlTypeEnum.Panel)
    pan.BackColor = clr1
    pan.BorderStyle = BorderStyle.None
    pan.Width = 220
    pan.Height = 399
    pan.Left = 230*i+5
    pan.Top = 5
    e.Form.Controls("hsr").AddControl(pan)
Next

For  i As Integer = 0 To s
    Dim txt As WinForm.TextBox = e.Form.CreateControl("TextBox" & i, ControlTypeEnum.TextBox)
    txt.MultiLine = True
    txt.BorderStyle = BorderStyle.None
    txt.BackColor = clr1
    txt.ForeColor = clr2
    txt.Font = fnt
    txt.Width = 218
    txt.Height = 163
    txt.Left = 230*i+6
    txt.Top = 235
    txt.text =  vbcrlf & "  品牌: " & t.Rows(i)("kkth")  
    e.Form.Controls("hsr").AddControl(txt)
Next

 

这个e.Form.Controls("hsr")已经是窗口的panel控件.

请老师指教!!!

谢谢!!!


--  作者:有点色
--  发布时间:2017/6/1 8:40:00
--  

Dim s As Integer = Tables("qrymyf").rows.count - 1

For  i As Integer = 0 To s
    Dim pan As WinForm.Panel = e.Form.CreateControl("Panel" & i, ControlTypeEnum.Panel)
    pan.BackColor = clr1
    pan.BorderStyle = BorderStyle.None
    pan.Width = 220
    pan.Height = 399
    pan.Left = 230*i+5
    pan.Top = 5
    e.Form.Controls("hsr").AddControl(pan)
    Dim txt As WinForm.TextBox = e.Form.CreateControl("TextBox" & i, ControlTypeEnum.TextBox)
    txt.MultiLine = True
    txt.BorderStyle = BorderStyle.None
    txt.BackColor = clr1
    txt.ForeColor = clr2
    txt.Font = fnt
    txt.Width = 218
    txt.Height = 163
    txt.Left = 230*i+6
    txt.Top = 235
    txt.text =  vbcrlf & "  品牌: " & t.Rows(i)("kkth") 
    pan.AddControl(txt)
Next

 


--  作者:有点蓝
--  发布时间:2017/6/1 8:41:00
--  
回1楼

r.Current("图像") = r.Current("编号") & ".jpg"   

--  作者:有点蓝
--  发布时间:2017/6/1 8:42:00
--  
Dim s As Integer = Tables("qrymyf").rows.count - 1
For  i As Integer = 0 To s
    Dim pan As WinForm.Panel = e.Form.CreateControl("Panel" & i, ControlTypeEnum.Panel)
    pan.BackColor = clr1
    pan.BorderStyle = BorderStyle.None
    pan.Width = 220
    pan.Height = 399
    pan.Left = 230*i+5
    pan.Top = 5
    e.Form.Controls("hsr").AddControl(pan)
    For  i As Integer = 0 To s
        Dim txt As WinForm.TextBox = e.Form.CreateControl("TextBox" & i, ControlTypeEnum.TextBox)
        txt.MultiLine = True
        txt.BorderStyle = BorderStyle.None
        txt.BackColor = clr1
        txt.ForeColor = clr2
        txt.Font = fnt
        txt.Width = 218
        txt.Height = 163
        txt.Left = 230*i+6
        txt.Top = 235
        txt.text =  vbcrlf & "  品牌: " & t.Rows(i)("kkth")
       pan.AddControl(txt)
    Next
Next

--  作者:wyz20130512
--  发布时间:2017/6/1 10:50:00
--  
 r.Rows("图像") = r.Rows("编号") & ".jpg"            \'编号是String

没有这种语法!!

Rows是行集合,通过行集合可以获得指定位置的行,比如:r.Rows(0) 第一行

获取行后可能通过列名称来访问指定的列,比如:r.Rows(0)("第一列")
[此贴子已经被作者于2017/6/1 10:54:10编辑过]

--  作者:jackyfashion
--  发布时间:2017/6/1 19:46:00
--  

谢谢老师!!!


--  作者:jackyfashion
--  发布时间:2017/6/1 19:49:00
--  
谢谢大师!!!
--  作者:jackyfashion
--  发布时间:2017/6/1 19:51:00
--  
谢谢老师!!!
--  作者:jackyfashion
--  发布时间:2017/6/1 20:52:00
--  

您好!

老师:

Dim tt As Table = Tables("yywrkhtc")
Dim lt17 = tt(17)("khtc") & "\\"
Dim dlg As New OpenFileDialog
\'Dim piv As WinForm.PictureViewer = e.Form.Controls("图片")
Dim pth As String = lt17
dlg.Filter= "图形文件|*.*"
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
    For Each file As String In dlg.FileNames
        Tables("表A").AddNew
        Dim r As Row = Tables("表A").Current
        r("图片") = r("编号") & ".jpg"
        FileSys.CopyFile(dlg.FileName,pth & r("ltsu"),True)
    Next
End If

上边的代码,就是多选图片有几个,复制在文件件是有几个,但都是同一个图片,

请老师指点!!!

谢谢!!!

[此贴子已经被作者于2017/6/1 20:52:55编辑过]