<address id="xpjh9"><listing id="xpjh9"><meter id="xpjh9"></meter></listing></address>

<address id="xpjh9"><address id="xpjh9"><listing id="xpjh9"></listing></address></address>
<noframes id="xpjh9">
<noframes id="xpjh9">

<address id="xpjh9"><address id="xpjh9"><listing id="xpjh9"></listing></address></address>
    <form id="xpjh9"></form><address id="xpjh9"><listing id="xpjh9"><menuitem id="xpjh9"></menuitem></listing></address>

      <noframes id="xpjh9">
      VB.net 2010 視頻教程 VB.net 2010 視頻教程 VB.net 2010 視頻教程
      SQL Server 2008 視頻教程 c#入門經典教程 Visual Basic從門到精通視頻教程
      當前位置:
      首頁 > 編程開發 > VBnet >
      • vb.net教程之VB.NET中TextBox的智能感知應用實例

      • 2018-06-10 19:56 來源:未知

      本文實例形式介紹了VB.NET中TextBox的智能感知實現方法,功能非常實用,具體如下:

      該實例主要實現:在TextBox中鍵入字符,可以智能感知出列表,同時對不存在的單詞(沒有出現智能感知的)自動顯示“Not Found”。

      對此功能首先想到的是利用TextBox的AutoComplete功能。該功能允許你設置不同形式的AutoComplete智能感知,譬如:

      1)AutoCompleteSource:設置感知源頭類型(這里是CustomSource)。

      2)AutoCompleteMode:設置感知的模式(輸入不存在的字符追加,不追加還是同時存在,這里顯然不追加)。

      3)AutoCompleteCustomSource:設置源頭數據(AutoCompleteSource必須是CustomSource)。

      接下來思考如何在輸入第一個字符的時候判斷是否被感知到,如果沒有則顯示文本。

      拖拽一個Label到窗體上,然后在TextBox的KeyUp事件中對數據源進行判斷(為了方便,直接先把數據源數據轉化成Array的形式然后使用擴展方法Any進行判斷),同時為了防止界面卡死,使用異步。

      具體實現代碼如下:

      ?
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      Public Class Form1
        Dim collection As New AutoCompleteStringCollection
        Private ReadOnly arrayCollection() As String = {"a"}
       
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
       
        End Sub
       
        Public Sub New()
       
          InitializeComponent()
          collection.AddRange(New String() {"apple", "aero", "banana"})
          TextBox1.AutoCompleteCustomSource = collection
          ReDim arrayCollection(collection.Count - 1)
          collection.CopyTo(arrayCollection, 0)
        End Sub
        ''' <summary>
        ''' When release the keys, plz start a background thread to handle the problem
        ''' </summary>
        Private Sub TextBox1_KeyUp(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyUp
          Dim act As New Action(Sub()
                       'Check whether there are any values inside the collection or not
                       If (TextBox1.Text = "") OrElse (arrayCollection.Any(Function(s)
                                                   Return s.StartsWith(TextBox1.Text)
                                                 End Function)) Then
       
                         Label1.BeginInvoke(New MethodInvoker(Sub()
                                              Label1.Text = String.Empty
                                            End Sub))
                       Else
                         Label1.BeginInvoke(New MethodInvoker(Sub()
                                              Label1.Text = "Not found"
                                            End Sub))
                       End If
       
                     End Sub)
          act.BeginInvoke(Nothing, Nothing)
        End Sub
      End Class

      這里有一些注意點:

      1)異步的異常不會拋出(因為異步的本質是CLR內部的線程),只能調試時候看到。因此編寫異步程序必須萬分小心。

      2)VB.NET定義數組(譬如定義String(5)的數組,其實長度是6(從0~5)包含“5”自身,因此數組復制(Redim重定義大小)的時候必須Count-1,否則重新定義的數組會多出一個來,默認是Nothing,這會導致異步線程出現異常)。

      相關教程
      江苏快3 www.aa355.com | www.x69096.com | 70118u.com | www.12136v.com | 2142233.com | www.081wy.com | www.32126q.net | 97297r.com | www.1818365.com | 27878gg.com | www.798588.net | 55818o.com | www.602434.com | www.hg4118.com | 8294x.com | www.423bbb.com | 2649z.com | www.566668.com | www.93818a.com | 1624ff.com | www.37377j.com | bg345.com | www.375477.com | www.635365.com | 7240z.com | www.6678566.com | 5369s.com | www.249880.com | www.20199ww.com | mmm67890.com | www.937065.com | www.pj5719.com | 6611412.com | www.0194003.com | www.yh8219.com | xpj816.com | www.06820x.com | xpj5007.com | www.843879.com | www.90989.com | 463e8.com | www.29277y.com | www.88807y.com | 56988g.com | www.959595.com | www.7720s.com | 28824o.com | www.881543.com | 73567tg12.com | 1697.com | www.6386b.com | 80878z.com | ms38648mm.cc | www.742588.com | pppp0066.com | 1483r.com | www.17jsc.com | www.www-728855.com | 28288c.com | www.69999.am | www.00618t.com | 2778aa.com | www.321.ceo | www.yl00555.com | vip61788.com | www.588730.com | www.7777yh.com | 588.cc | 6969xpj.com | www.38775nn.com | www.hg22768.com | 888898.cc | www.35918p.com | www.yongligao.hk | 4556v.com | www.658770.com | www.xx3.com | 8901n.com | s83377.com | www.84499g.com | www.49981k.com | 8159n.cc | www.072211.com | www.97828r.vip | www.7830a.com | 9949i.com | www.c5884.com | www.607967.com | n2649.com | 63305a.com | www.53900k.com | www.d444.com | 30006u.com | hc8001.com | www.hy6933.com | www.16181i.com | www.hg3388.org | 8901q.com | www.545568.com | www.wns123h.com | www.h27229.com | 4488g.com | 3648.net | www.12455r.com | www.c559cc.com | 1098.com | 69443366.com | www.055972.com | www.48330v.com | www.xpj3200.com | 159666z.com | 3078i.com | www.105ak.com | www.06820x.com | www.3xinhao.com | 36403377.com | z47479.com | www.36166p.com | www.2302325.com | h4455g.com | qy228.vip | www.602582.com | www.js89k.vip | www.0860q.com | 800089v.com | zhcp88.com | www.2350z.com | www.4058ii.com | www.xpj88007.com | df8bet.com | dzjcp88.com | www.ck8299.com | www.47506i.com | www.84898v.com | 7942.com | u4212.com | www.392477.com | www.36586666.com | www.1168g.com | www.7025o.com | df8b.com | 55545g.com | www.128368.com | www.49956y.com | www.33111166.com | www.69880.com | xx4455.com | 69111m.com | 61329999.com | www.657259.com | www.2418q.com | www.5sj.com | www.7830t.com | 6766ii.com | 5856ff.com | hg15515.com | www.bai355.com | www.hgbet1.com | www.444412.com | www.77788806.com | 2805s.com | xpj677c.com | x5039.com | www.c757.vip | www.4323c.com | www.80188t.com | www.hg7211z.com | www.yh8005.com | yz5488.com | 112n.net | 22883.com | ly88888883.com | www.cha62.com | www.993916.com | www.89599m.com | www.228369.com | www.3k777.com | ahga008.com | 793929.com | 1077zz.com | www.77802e.com | www.hm7388.com | www.7239d.com | www.115527r.com | www.80365.bet | www.788078.com | www.033033t.com | x7570xx.com | 7n3777.com | 11tyc.com | 80892b.com | www.292269.com | www.967333a.com | www.26299i.com | www.99552.com | www.4212z.com | www.105242.com | www.17828v.com | www.kb8828.com | 588-2.cc | 2019hh.cc | amjs8033111.com | 4036rr.com | 112n.net | 8381d.com | 5003ii.com | 5446v.com | www.43131v.com | www.610560.com | www.igcp1.com | www.54400r.com | www.6613655.com | www.4809s.com | www.4521l.com | www.71071n.com | www.5049s.com | www.548866.com | www.787116.com | www.xb0027.com | www.f5566.com | www.a0055.com | www.546995.com | www.1869j.com | qbzb2b.net | 2350.com | 4812e.com | 3018pp.com | 7792b.com | 38345y.com | 50000029.com | www.pu1678.com | www.86611m.com | www.580583.com | 99932949.com | www.wxr44.com | 1594005.com | www.j854.com | www.hg313.com | www.d276.com | www.pj8188.com | www.279765.com | www.wf5588.com | www.9870x4.com | www.123f4.com | www.3165.com | www.5504g.com | www.98698m.com | www.55070a.com | www.466890.com | www.wns123c.com | www.xjs733.com | www.bjl916.com | www.ya2019o.com | www.33997w.com | www.108ak.com | www.703602.com | www.506731.com | www.111306.com | 69447711.com | 0128765.com | 00669193.com | pj88pp.com | 6487lll.com | jing7773.com | 01365.com | www.8124y.com | www.365815k.com | www.41230599.com | www.228778b.com | www.0022xpj.net | www.d2894.com | www.1199.am | www.5441i.com | www.717772.com | www.117035.com | 666vn77.com | 61652b.com | 4255www.com | 70118e.com | www.ao599.com | www.333133s.com | www.678987.com | www.5099ss.com | www.087c.com | www.89959.cc | www.351089.com | 5144s.com | 3644m.com | yxrmdryl.com | www.7435y.com | www.77288ii.com | www.hbao5.com | www.j94600.com | www.7793v.com | www.338218.com | 99567v.com | 0166e.com | 00773vv.com | www.28758v.com | www.442336.com | www.huangma25.com | www.886948.com | www.hf5889.com | 5001c.com | 655660066.com | 444000u.com | www.am0674.com | www.suantm.com | www.4102y.com | www.2350v.com | www.028082.com | 7792t.com | 20055599.com | www.56520v.com | www.423550.com | www.37377a.com | www.735037.com | v32365.com | yh645.cn | www.00829q.com | www.68806.com | www.7434.com | www.355294.com | ly88888880.com | 2389.com | www.tb970.com | www.hv99365.com | www.627012.com | 3018hh.com | yhdhz.com | www.848xpj.com | www.938n.cc | www.ya2019o.com | www.397836.com | cp11991.com | 8036k.com | www.227777.com | www.9989587.com | www.526087.com | 7249e.com | 30007c.com | www.03719c.com | www.h98478.com | www.587244.com | 94111ddd.com | 54443y.com | www.20199jj.com | www.77802t.com | 1607.com | bet28f.com | www.vns7330.com | www.5886oo.com | www.662358.com | v9s.com | www.86611f.com | www.55c668.com | www.60123q.com | 2820x.com | 11662007.com | www.330007.com | www.6889798.com | www.005845.com | t1915t.com | www.5599pj.com | www.hbet97.com | www.196507.com | iii67890.com | www.hd66.am | www.9422d.com | www.082712.com | 3614u.com | www.huangguan1088.com | www.96877.com | www.109026.com | 88903636.com | www.438686.com | www.68689q.com | 22296tt.com | 2400007.com | www.5099jj.com | www.909888.com | 3983004.com | www.655666h.com | www.9350.vip | jkglpeixun.com | ww3189.com | www.356063.com | www.cb0999.com | nn500n.com | www.44446609.com | www.yh66266.com | 2546l.com | 047105.com | www.q1432.com | www.062166.com | 80850kk.com | www.314996.com | www.810702.com | 3467t.am | www.74849.com | www.66fzc.com | 80567k.com | www.03688.com | www.36788r.com | 3559666.cc | www.777307.com | www.80065w.com | 3983009.com | www.10050011.com | www.52303h.com | 04666j.com | www.910633.com | www.34788y.com | 1705g.com | www.77605b.com | www.3126z.com | 0289a.com | www.787116.com | www.lqc2.com | 3416l.com | www.sj52088.com | www.303480.com | 2805r.com | www.xj6004.com | 256777k.com | www.tushan98.com | www.7406.Com | zhcpyy.com | www.hg9698.com | www.flcb1.com | yyy4165.com | www.d5667.com | www.083025.com | aa8bb8.com | www.9989579.com | 1634v.com | www.16711.com | www.wcp6698.com | 61326666.com | www.o063801.com | 1483p.com | www.o30226.com | www.6661e.cc | 3890f.com | www.28000u.com | 00048j.com | www.28758v.com | www.50051p.com | 4167j.com | www.7415e.com | 98955i.com | www.56520r.com | www.2373b.com | yh88133.vip | www.47506s.com | 567pj.com | www.883399u.com | www.548511.com | 20775588.com | www.77996c.com | 4488ii.com | www.7893w35.com | 1591qqq.com | www.01899.com | www.550919.com | 90307v.com | www.50989k.com | afcp09.com | www.07679t.com | 11555156.com | www.97937.com | 50023366.com | www.hg8259.com | www.139630.com | www.51990.com | www.hx6600.com | 2767k.com | www.858466.com | 8037nnn.com | www.3w111.com | 2418o.com | www.04567k.com | 2613a.com | www.53848.com | 7196t.com | www.hg9396.com | www.371956.com | www.8494i.com | www.881803.com | www.556zr.com | www.08gcw.com | 2698v.com | www.87467.com | 2589.com | www.08588c.com | 2267m.com | www.73166k.com | swin1.com | www.91233n.com | v2351.com | www.84499p.com | 2757k.com | www.50080n.com | 123456vip.cc | www.6539w.com | h47479.com | www.757zf.com | www.bmcp1344.com | www.783802.com | www.bet365604.com | www.550116.com | www.558js.com | www.081306.com | www.1010160.com | 040967.com | www.35877c.com | 99909w.com | www.19yh3.com | 55331s.com | www.63606j.com | 4556k.com | www.975510.com | dzc05.com | www.022gx.cc | www.www-866766.com | www.389844.com | www.xhtd05.com | vip.city78.cn | www.g456x.com | pj00.com | www.am57877.com | 80368pp.com | www.2350n.com | www.888vip5.com | www.209983.com | www.hg7938.com | 3258o.com | www.4196o.com | 566777b.com | www.81678l.com | 866bc.com | www.566011.com | www.236js.com | jixiang10.com | www.a12189.com | 66681k.com | www.15855.cc | www.41414688.com | vncseojs.com | www.6664ylg.com | 01234vvv.com | www.1368a.cc | www.wwwjs6899.com | 80878n.com | www.80188q.com | hjdc43.com | www.qml2.com | www.993639.com | 30019ff.com | www.3507777.com | 2021nnn.com | www.694050.com | www.yiyao12.com | 4255ee.com | www.80wb.top | www.ag9921.com | 39990033.com | www.xpj228888.com | tony001.com | www.799481.com | www.331333.com | 025902.com | www.81233l.com | www.fed888.com | 4809w.com | www.5446t.com | 26444a.com | www.061966.com | www.7415w.com | 55797j.com | www.785579.com | www.622206.com | 3482r.com | www.55cmc.com | www.mt2888.com | 6630081.com | www.53900p.com | www.9679o.com | 23233o.com | www.7239p.com | www.655666e.com | 93936t.com | www.879528.com | www.333133z.com | 6175a.com | www.81233q.com | www.hg1668.com | 11555156.com | www.5854m.cc | www.29962.com | 6112ii.com | www.hh8618.com | www.38238y.com | 7k7k.com | www.490780.com | www.695014.com | 3167.com | xinshijiylc6.com | www.16065i.com | www.77537r.com | 7357.com | www.ascp6.com | www.vns968.com | 88851y.com | www.303470.com | www.4196q.com | 159194.com | bet89226.com | www.54400x.com | www.84303.com | 4955y.com | www.349311.com | www.4196j.com | www.13602477523.com | cp019.com | www.25688j.com | www.1155025.com | 28288.com | ctxcp68.com | www.pjzxyl.cc | www.448628.com | 32008.com | www.55228e.com | www.h63568.com | www.330099p.com | c1915.com | www.362322.com | www.63606z.com | www.boma0124.com | 77605d.com | www.530391.com | www.222367.com | www.474.net | 3131e.cc | www.320055.com | www.55755.com | www.4483899.com | mg6888.com | bo9.co | www.rfdc07.com | www.49581.com | 19880s.com | 915904310.com | www.5095y.com | www.303015.me | lc4343g.com | 1434c.com | www.811257.com | www.i063801.com | www.8694s.com | 4426234.com | 7811uu.com | www.0270j.com | www.wnsr999.com | 8547o.com | 5002com | www.779zf.com | www.bwin910.co | www.995r.net | 7742yy.com | vipdz88.com | www.bxcp4.com | www.33678gg.com | www.cs6663.com | 80368fa.com | 55zz8332.com | www.702572.com | www.siji05.com | www.681234.com | spbo.com | s58955.com | 6261g.com | www.66ffz.com | www.8099777.com | www.1688hg.com | 2851p.com | 0208kk.com | 1665k.com | www.371f.cc | www.44118m.com | www.3709885.com | 3544l.com | 7240t.com | 9964.com | www.677879.com | www.js02348.com | www.808888c.com | www.655666f.com | z62365.com | 8200.cn | js22991.com | www.58ipo.com | www.blr6644.com | www.dckpv.com | www.87879193.com | p2824.com | 0860d.com | 500000791.com | www.769289.com | www.01924.com | www.4136b.com | www.mgm9987.com | lshtq.cn | 32126j.net | 50022211.com | 2677eee.com | www.640118.com | www.86267w.com | www.4521h.com | www.778879.com | www.56520g.com | 6245a.com | yh66555.com | 6033e.com | 850.com | www.602266.com | www.50051t.com | www.681183.com | www.2805.com | www.666suncity.com | www.hg1233.com | 780.so | 7172004.com | 500000597.com | 386kzb.com | www.506906.com | www.2408d.cc | www.574119.com | www.x2894.com | www.ggo.99233o.com | www.708118.com | www.7435b.com | 88807m.com | x33h.vip | 3435z.com | 2007tt.com | 65335.com | 3aobo.com | www.286276.com | www.912162.com | www.15355j.com | www.ykylc01.com | www.245252.com | www.30hga.com | www.234894.com | www.1213699.com | www.56520y.com | www.ylg5999.com | 111122nn.com | 85698a.com | 15942222.com | 3405vvv.com | 3412233.com | 66119193.com | dh3868.com | pppp0099.com | 496ww.com | www.43131p.com | www.353990.com | www.691063.com | www.c5957.com | www.5086u.com | www.81233p.com | www.yl13444.com | www.44074.com | www.38775ss.com | www.47506x.com | www.xpj618.com | www.365077.bet | www.751cp2.com | www.tbet899.com | www.778333.com | www.tyc57.com | www.5888868.com | www.xpj2778.com | www.xw2200.com | www.lianhua1.com | www.2846l.com | www.aa3143.com | www.3643a.com | www.4107p.com | www.7893900.com | www.js3444.com | www.39695u.com | www.4107e.com | www.56520y.com | www.s30226.com | www.c4737.com | www.558422.com | www.www8181msc.com | www.777444e.com | www.g0041.com | www.js7009.com | www.3a332.com | www.43788.com | www.ssss8025.com | www.5966fff.com | www.df5805.com | www.5bet005.com | www.j36.cc | www.vns55.me | www.48330r.com | www.3a436.com | www.50080g.com | www.2350f.com | www.957806.com | www.luck887.com | www.220875.com | 11116556.com | 06006p.com | 749304.com | 2844f.com | 8888c9.com | 8977hh.com | 7141bb.com | www.dz578.com | www.67797a.com | www.0033222.com | www.bj052.com | www.rycp156.com | www.js79905.com | www.99094v.com | www.81233p.com | www.qbwc5.com | www.449810.com | 496oo.com | 32126i.net | 225605.com | 2037.com | 5003ggg.com | www.3046k.com | www.79tyc.com | www.50999z.com | www.v1068.com | www.372733.com | www.99ckb.com | www.397411.com | 99151y.com | 3467q.cc | 67890v.com | 500000710.com | www.alpk00.com | www.781msc.com | www.7370.com | www.110252.com | www.60108k.com | www.745126.com | xmhouse.com | 86155.com | 3404t.cc | 88445156.com | www.7607633.com | www.6a333.com | www.30350g.com | www.84499j.com | www.860836.com | 22558332.com | 673305.com | 61326611.com | www.76060i.com | www.993456.com | www.18k0048.com | www.91233n.com | www.684050.com | bct6688.com | b68080.com | jjjj004.com | www.7545q.com | www.00618i.com | www.hg785.com | www.782478.com | lbzyfz.com | ee01234.com | www.ab943.com | www.654234.com | www.6880.com | www.1555hc.com | 20679455.com | 3999.com | lehu556.com | www.21884.com | www.2997774.com | www.yi876.com | 80850p.com | 211707.com | www.033033i.com | www.345345.com | www.a3846.com | www.c6096.com | feicai0933.com | 222092.com | www.111xpj22.com | www.7668888.com | www.cq58qp.com | www.737298.com | qycp356.com | 998cpdl.com | www.uu0096.com | www.9170116.com | www.15355h.com | 8988i.com | 4488jj.com | www.333222l.com | www.58665x.com | www.81233j.com | www.77801i.com | 80892h.com | www.3371777.com | www.csh365.com | www.js55785.com | www.177524.com | ll00558.com | www.kk2233.com | www.77731r.com | www.80065s.com | hr1844.com | 88993n.com | www.tyc636.com | www.yh234f.com | www.c1636.com | 048.com | tyc70.com | www.799666g.com | www.83033r.com | 89892uu.com | 40661115.com | www.hg8968.com | www.xpj8558.com | www.514677.com | q08199.com | www.vip0088.cc | www.b35xx.com | www.933777a.com | 1859004.com | www.9846j.com | www.6666yh.vip | www.igcp7.com | 1634c.com | 27878xx.com | www.255837.com | www.loll3.com | 2455g.com | www.6033w.com | www.9737nn.com | www.138136a.com | 6177006.com | www.8124a.com | www.58404c.com | www.726703.com | a97570.com | www.yh8894.com | www.12136l.com | www.188732.com | r67890.com | www.hg8237.com | www.97655s.com | 2306m.com | 272a.net | www.57800c.com | www.676477.com | 4466303.com | www.yh795.com | www.683248.com | 7779s.cc | 5168555.cc | www.bet91487.com | www.739233.com | 4488w.com | www.jing6661.com | www.71399y.com | 5443ss.com | www.0000wnsr.com | www.801sun.com | 55oo8332.com | 2820i.com | www.bwinyz20.com | www.399140.com | 7042004.com | www.sun3678.com | www.fyyy9.com | 8015h.com | www.hg8549.com | www.3890l.com | 5651g.com | www.7636.com | www.68689k.com | 78110077.com | www.h7788a.com | www.818225.com | 7893w07.com | www.67797y.com | www.sx13997.com | blr81.com | www.zzzz0291.com | www.2418m.com | ii1331.com | www.655666d.com | www.4323i.com | 1466s.com | www.v15552.com | www.23636f.com | ggg5682.com | www.xpj180.com | www.gyfc8.com | 3656qq.com | www.138cpj.com | www.372411.com | 5589b.com | www.441766.com | itkvm.net | www.7hg88.com | www.6768997.com | k08199.com | www.09569y.com | www.9818v.cc | 4255s.com | www.1994365.com | www.524077.com | zhcpff.com | www.178633.com | xpjdc.tw | www.8694w.com | www.50052d.com | 61366d.com | www.55526t.com | www.303717.com | 6977555.com | www.win1235.com | 1596e.com | www.59503.com | www.874110.com | 2127e.com | www.40288c.com | 15a43.net | www.msc77.net | www.vt34.com | 7k7k.com | www.540640b.com | 2306p.com | www.i55106.com | www.cb5588.com | 55331.com | www.6057777.com | 01234p.com | www.302848.com | www.407872.com | 88948999.com | www.0883888.com | 69448866.com | www.m456x.com | bc21888.com | www.282205.com | www.ybao7.com | 112l.net | www.7249z.com | 563745.com | www.808888u.com | 3122e.com | www.900673.com | www.768399.com | 55155s.com | www.77803l.com | rbbet88.com | www.xpj11882.com | jr9933.com | www.ywcp999.com | 2546q.com | www.vns0952.com | www.377192.com | www.l32126.cc |