国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

Getting Datagrid Columns Keypress,Keyup, Keydown a

2024-07-21 02:16:54
字體:
來源:轉載
供稿:網友
'it might be easier to read the code if you
'copied this to a text program

'after your form has a functioning datagrid and dataset,
'do the following steps.
'1) name and declare each column as a textbox as follows

friend withevents column1 as textbox
friend withevents column2 as textbox

'2) create the tablestyles.
'here is the code microsoft gives to do just that.
'(again i did not write this part; its copied and 'pasted from ms!!)

private sub addtables(byval mydatagrid as datagrid, _
                    byval mydataset as dataset)
      dim t as datatable
      for each t in mydataset.tables
                    dim mygridtablestyle as datagridtablestyle = new _
                    datagridtablestyle()
                    mygridtablestyle.mappingname = t.tablename
                    mydatagrid.tablestyles.add(mygridtablestyle)
                    ' note that datagridcolumnstyle objects will
                    ' be created automatically for the first datagridtablestyle
                    ' when you add it to the gridtablestylescollection.*/
     next
end sub

'3) add the next line of code in the form load event
      'use your own variable names for the datagrid and dataset)
      addtables(datagrid1, dataset1)
      'creates the variable to identify object
      dim tempcolumn as datagridtextboxcolumn
      'sets the variable to the datagrid column
      tempcolumn = datagrid1.tablestyles(0).gridcolumnstyles(0)
      'set the column (textboxe actually) equal to the
      'temporary column you just created.
      column1 = tempcolumn.textbox
      'repeat for each column you made. notice the next line is
      'the same as the previous except it now identifies the
      'next column (one instead of zero) and the line after
      'that is the next column you created in step 1.
      tempcolumn = datagrid1.tablestyles(0).gridcolumnstyles(1)
      column2 = tempcolumn.textbox

'4) write the code for whatever event you want to fire. notice
'after you declared the variables withevents then they now appear
'as a class in the drop down menu. here is example to see the
'keypress events fire for the two columns you identified.


      private sub column1_keypress(byval sender as object, _
                    byval e as system.windows.forms.keypresseventargs) _
                    handles column1.keypress

                    msgbox("you have pressed the " & e.keychar)

      end sub

      private sub column2_keypress(byval sender as object, _
                    byval e as system.windows.forms.keypresseventargs) _
                    handles column2.keypress

                    msgbox("you have pressed the " & e.keychar)

      end sub 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 台东市| 靖宇县| 佛山市| 萍乡市| 岑巩县| 青海省| 万州区| 讷河市| 伊宁市| 四川省| 玉山县| 赤城县| 舒城县| 潞西市| 新密市| 浦城县| 当雄县| 咸阳市| 荃湾区| 赤峰市| 三明市| 齐河县| 临武县| 汝南县| 金湖县| 宁城县| 景宁| 昂仁县| 浙江省| 孝感市| 东乌珠穆沁旗| 迁西县| 佛山市| 舒兰市| 黔西县| 滦南县| 眉山市| 云南省| 凉山| 会同县| 靖江市|