大众信息网

问一个关于vb的grid控件的问题

关注:126  答案:2  手机版
解决时间 2021-01-16 14:27
怎样把grid控件里选择的内容添加到text控件中?
最佳答案
dim 记录集 as new adodb.recordset
open "记录集",连接
text控件.text=记录集(记录)
全部回答
行啊: dim cn as new adodb.connection dim rs as new adodb.recordset public function adodbjet(optional dbfile as string, _ optional pwd as string) as adodb.connection on error resume next dim defdb as string '数据库文件请自行设置 defdb = app.path & "\bond.mdb" if dbfile = "" then dbfile = defdb set adodbjet = new adodb.connection adodbjet.open "provider=microsoft.jet.oledb.4.0;" & _ "persist security info=false;user id=admin; " & _ "jet oledb:database password=" & pwd & "; data source=" & dbfile if adodbjet.state <> 1 then set adodbjet = nothing end function private sub form_load() set cn = adodbjet if cn.state = 1 then rs.open "select * from member2", cn, 1, 2 set vg1.datasource = rs end if with vg1 .editable = flexedkbdmouse '可用键盘和鼠标编辑 .allowuserresizing = flexresizebothuniform '可用鼠标调整单元大小, 如果值为“flexresizeboth”则单独调整行高或列宽 .scrolltrack = true '行随滚动条翻滚 .wordwrap = true '单元中的文本过长换行显示 .additem "" '添加一行为了新增内容 end with end sub
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!