国产探花免费观看_亚洲丰满少妇自慰呻吟_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 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 呼伦贝尔市| 化隆| 汉源县| 高邑县| 内黄县| 张家界市| 吉木萨尔县| 墨江| 平定县| 鹤岗市| 青冈县| 奎屯市| 凤山县| 木兰县| 台北市| 辰溪县| 宝清县| 辽宁省| 建阳市| 广东省| 阜南县| 梁山县| 大田县| 福海县| 岫岩| 甘肃省| 汉中市| 新竹市| 黔江区| 临邑县| 科技| 靖远县| 大关县| 江陵县| 台东县| 泗阳县| 永嘉县| 福州市| 抚松县| 方山县| 莎车县|