<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.ylylc00.com | 5804s.com | 228888d.com | www.3116g.com | r4212.com | www.4694l.com | huangma21.com | www.68277444.com | 2757g.com | www.506930.com | pj88ee.com | www.686727.com | 57157j.com | www.78919c.com | 8290j.com | www.606370.com | www.hg9812.com | www.548116.com | www.sun7708.com | www.596353.com | www.xpj8548.com | 0198844.com | www.07576.com | 566670099.com | www.97828h.vip | 8722jjjj.com | www.35155s.com | zhcp62.com | www.664by.com | hg37370.com | www.855876.com | www.gh0031.com | www.891079.com | www.55422o.com | 2245.com | www.js79904.com | 5536699.com | www.1232222.net | 9994cc15.com | www.5095m.com | 5003hhh.com | www.865850.com | www.604700.com | 5446tt.com | www.848524.com | 20188t.com | www.68682j.com | www.wns8828.com | www.382780.com | www.07991.com | 1770o.com | www.4996ty.com | 2247aa.com | www.52072m.com | www.6677psb.com | 0615002.com | www.954321l.com | 22207t.com | 53262l.com | www.9646q.com | www.xpj9199.com | 9734vip.com | www.19k0048.com | 56787bb.com | www.h679.com | www.56655c.com | 4340w.com | www.936336.com | www.456099.com | 2127gg.com | www.2655268.com | www.hg88.us | 777hg.com | www.68070.com | www.hai6666.com | hh03.com | www.865510.com | www.58665n.com | 99111ff.com | www.526197.com | www.47506n.com | 55155d.com | wlb111.com | www.2418c.com | www.58js88.com | 38738711.com | www.33031.cc | www.sun0003.com | vns00ff.com | www.919588.com | www.4136o.com | 00773cc.com | www.514033.com | www.2848aaa.com | www.bet36579.com | 8881480.com | www.959551.com | www.mhcpgw.com | k35151.com | 23800x.com | www.8999ka.com | www.32253.com | 2613i.com | 11882007.com | www.098wy.com | www.472705.com | ms888.com | 585886.com | www.847677.com | www.xj6005.com | 5004dd.com | 30007l.com | www.547099.com | www.087r.com | www.7893800.com | js8068.com | www.36166v.com | www.50788r.com | www.5966yyy.com | www.hgc444.com | 30173388.com | www.586198.com | www.2021.com | www.xpj386.com | 3467z.am | l4255.com | www.8885888.com | www.711893.com | www.v88130.com | www.0555hg.com | 4303.com | www.183209.com | www.2208553.com | www.9679u.com | 72227.com | 9149l.com | www.529799.com | www.333682.com | www.3122oo.com | 99151f.com | 69111m.com | ylzz1113.com | www.54400y.com | www.9170011.com | www.655666e.com | 66287u.com | 09t55.com | www.909938.com | www.15048u.com | 88999193.com | 8381t.com | js6444.com | www.91233o.com | www.28462000.com | www.393002.com | www.333133d.com | yth13.net | hc.cc | 33432t.com | www.899621.com | www.4833058.com | www.bwinyz23.com | www.71234010.com | 500599.com | 5856rr.com | 33998016.com | www.358939.com | www.js02346.com | www.vns6607.com | www.84859.com | www.4759xx.com | g2306.com | amhg022.com | 08058888.com | www.305644.com | www.185647.com | www.63606t.com | www.808msc.com | www.32666z.com | 5429u.com | 0hga.com | 30688x.com | pj88488.com | 88995003.com | www.549077.com | www.00tdc.com | www.7737bb.com | www.6669ylg.com | www.400131.com | www.pj5904.com | www.vns9984.com | 1775ee.com | 22299ww.com | 026237.com | 78666v.com | 55331yy.com | www.312876.com | www.c6167.com | www.55717h.com | www.hg8ee.com | www.468546.com | www.671100.com | www.2090922.com | www.6000bjl.com | 50028822.com | 11884747.com | l08199.com | 3030394.com | 77606q.com | aaa8996.com | 37amjs.com | 833.com | 2081.com | 5592958.com | 7335g.com | sxkcl.net | 684237.com | dd2649.com | 1589.com | 8742ii.com | 55402dh.com | 7196w.com | www.65707v.com | www.196148.com | www.394677.com | www.493306.com | www.hcjt7.com | www.26163x.com | www.9149p.com | www.35czj.com | www.091wy.com | www.918jo.com | www.99cmc.com | www.c1370.com | www.9818t.cc | www.823023.com | www.847980.com | www.680780.com | www.576590.com | www.424223.com | www.239544.com | www.420689.com | www.136052.com | www.339189.com | 89777m.com | g17022.com | 53262l.com | 148030.com | 94111.com | 7599w.com | 001122332.com | 3301855.com | 168cp-t.com | 9411uuu.com | pj268.vip | www.9068ss.com | www.amvip555.com | www.78221g.com | www.x4042.com | www.00618i.com | www.14168e.com | www.dayou567.com | www.7793z.com | www.5522u.cc | www.590981.com | 6647d.com | 9068t.com | qq365h.com | 469.com | ibc88.com | youle307.com | www.2078b.com | www.8000hm.com | www.9c567.com | www.33678ss.com | www.6482b.com | www.ybao3.com | www.197091.com | 1106766.com | 2381ppp.com | vv3405.com | ca7099.com | www.3643d.com | www.2850899.com | www.16181z.com | www.55717p.com | www.055g.cc | www.253230.com | zhcp47.com | 3678qqq.com | 314.cc | www.849558.com | www.caibb.com | www.7415tt.com | www.48330b.com | www.dqz6.com | 3009h.com | r2490.com | pj7702.com | www.5665699.com | www.358955.com | www.p69096.com | www.15.net | www.698771.com | lg888888.com | 3836.com | 38989x.com | www.3569b.com | www.xinpujingcaipiao.com | www.5350.vip | www.874966.com | 0747o.com | jx2300.com | ylzz366.com | www.hg7861.com | www.06386688.com | www.371t.cc | 99111hh.com | 4165q.com | www.033033k.com | www.hh536.com | www.00778h.com | www.5854q.cc | 9h2.com | 3977.com | www.1596d.com | www.73990g.com | www.0058c.com | 7141kk.com | 4340o.com | www.06068006.com | www.89677r.com | www.055w.cc | bet999000.com | 55552007.com | www.ytvip98.com | www.6688kcd.com | www.500yf.com | 56988pp.com | 496qq.com | www.40686a.com | www.h7764.com | www.c5638.com | 66287r.com | fh7.com | www.5604q.com | www.91779k.com | www.974306.com | 077ll.com | b2554.com | www.68683.com | www.sands2008.com | www.763117.com | 86811w.com | 518cp-8.com | www.g9478.com | www.21202hh.com | www.108382.com | 3778tt.com | www.98699.com | www.http://443598.com/ | www.864955.com | 5099hh.com | 2455y.com | www.423550.com | www.99638n.com | 123456hh.cc | 500000472.com | www.56655n.com | www.8499p.com | 1110099.com | 39830d.com | www.28000r.com | www.3479u.com | 3178nn.com | www.76060m.com | www.eb000.com | www.3552k.com | 6868456.cc | www.3657f.com | www.75600v.com | 99567g.com | 0434355.com | www.138136.com | www.849642.com | bc495.com | www.ty1148.com | www.76520r.com | 2245dl.com | www.629554.com | www.w84t.com | 666ths.com | 39558811.com | www.355422.com | www.5086q.com | 5443w.com | www.vns76999.com | www.8816n.com | 871ww.com | www.17828v.com | www.68568w.com | 2015288.com | www.f5566.com | www.83033k.com | 5309u.com | www.am0675.com | www.4331e.com | 888898.cc | www.mgm006.com | www.82894.com | haoshou188.com | www.3643p.com | www.50066c.com | 1365.com | www.z4777.com | www.918io.com | f21148.com | www.813365.com | www.579411.com | 44ll8332.com | www.ldz333.com | spj5577.com | www.888vip3.com | www.5446.com | 111122uu.com | www.1347-03.com | www.83993z.com | 876878k.com | www.73518.com | www.710930.com | 28288t.com | www.2544g9.com | 234916.com | www.8814e4.com | www.7239b.com | 0193377.com | www.568000.com | www.230278.com | www.1869z.com | www.1861222.com | dafa2618.com | www.ys0033.com | www.355911.com | yl77yl33.com | www.0270w.com | 4590bb.com | www.365022.bet | 2997772.com | www.4938v.com | www.w935.com | 55818w.com | www.7240u.com | 99699q.com | www.67297.com | www.307797.com | www.p2666.com | www.16878g.com | 3750.com | www.wns123a.com | 99151w.com | www.128567.com | www.339281.com | www.b3657.com | www.81233k.com | 04666t.com | www.417920.com | hgc388.com | www.335217.com | xpj99.am | www.zz00y.com | www.78949o.com | www.655666i.com | www.832793.com | 2682hd.com | www.3478w.cc | 2546j.com | www.76520y.com | 4182.com | www.836bbb.com | 1294z.cc | www.38775xx.com | 9007893.com | www.8j3.com | tzvip2020.com | www.848777k.com | 3y999.com | www.808888j.com | 1294z.com | www.dzcp8888.com | 5446v.com | www.70039n.com | 009900u.com | www.130823.com | 796939.com | www.533589.com | 027652.com | www.jh6677.com | 11nn8331.com | www.27363m.com | 0120002.com | www.jz787.com | hgc388.com | www.89677g.com | 444000kk.com | www.535083.com | aa8159.cc | www.6889775.com | x7570xx.com | www.73166f.com | 2649w.com | www.65707x.com | ambyc6.com | www.cb7388.com | www.88365.net | www.375769.com | www.hg00111.com | 6969xpj.com | www.yh98598.com | 55967n.com | www.7415l.com | 55577381.com | www.165888.com | 9737oo.me | www.666xm.cc | www.x552.com | 0788.com | www.557789.com | 55ee8331.com | www.6889775.com | zhcp52.com | www.976506.com | www.707365.com | 54141122.com | www.xg78.com | 6033l.com | www.12345604.cc | df8z.com | www.19czj.com | www.333133l.com | 0208aa.com | www.jz787.com | 35222p.com | www.81520m.com | www.033033s.com | www.202370.com | www.0748.cc | 3mgmqqq.com | www.sx1833.com | 1466m.com | www.186371.com | www.4399msc.com | 449649.com | www.624202.com | www.86611b.com | www.99677u.com | www.198004.com | 8037dd.com | www.74972.com | www.87680x.com | 5200e.com | www.3032nn.com | dzhcp4.com | www.729133.com | www.25000c.com | 496ss.com | www.71399f.com | www.65199.com | 0931jiehun.com | www.6386d.com | 3379kk.com | www.810523.com | www.55690.com | 060fff.com | www.16878g.com | www.32126z.net | 626810.com | www.ag.hg3005.com | www.pjbeijing.com | xpj51333.com | www.86339y.com | 6363t.com | 71005.com | www.33678mm.com | 5589t.com | www.401345.com | www.86999b.com | 33382v.com | www.250552.com | www.26123kk.com | 26444m.com | www.43131s.com | www.115527a.com | 55335004.com | 3242m.com | www.778305.com | www.hg8004.com | 7742xx.com | www.js18686.com | www.39695i.com | 2934o.com | www.108011.com | www.am9999.cc | 30175555.com | www.cb7288.com | www.i7793.com | js004.com | www.035059.com | www.ww55826.com | ii5443.com | 09244777.com | www.5856879.com | www.3056008.com | 86688008.com | www.c6321.com | www.5504b.com | 025132.com | 85882.com | www.538445.com | www.1113939.com | yk117.com | www.c277.com | www.wy8008.com | feicai0756.com | 3122x.com | www.43818h.com | www.pj6668.com | 7720.net | 123456xx.cc | www.bet73h.com | www.v6187.com | 8721331.com | www.66621o.com | www.97828e.vip | www.pj1098.com | 4165t.com | www.640477.com | www.58118e.com | lehu808.com | yd12308.com | www.fl98.com | www.04567z.com | www.m1977.com | 2jsppp.com | www.763227.com | www.2544g2.com | www.hjdc2000.vip | 0729i.com | www.310383.com | www.c63568.com | www.b2229b.com | 51599.com | sxpj62607.com | www.3890w.com | www.5099ff.com | www.6177a.com | 983888f.com | www.010986.com | www.7880.com | www.773678.com | hfjxss.com | 8381d.com | www.302830.com | www.13434f.com | www.5811msc.com | lemcoo.com | 08530009.com | www.77802v.com | www.79520c.com | www.500cp.cc | www.w7w7.com | 17797777.com | 4323i.com | www.849770.com | www.4809t.com | www.37767.com | 4052c.com | 55717aa.com | 7605z.com | www.8499q.com | www.469701.com | www.3775488.com | 9949o.com | 72550.com | 99589cc.net | www.6661e.cc | www.6687b.com | www.21033.com | 626844app.com | 4260011.com | 112j.net | www.39459.cc | www.63606f.com | www.72hk.com | www.1941vip.com | 40033yyy.com | xh999.com | www.312102.com | www.50026r.com | www.516297.com | www.hgw00888.com | www.hd585.com | 97297p.com | 66335003.com | www.588088.com | www.97655r.com | www.3983184.com | www.518008.com | js910.com | 001122335.com | ag80.vip | usacits.com | www.839658.com | www.506612.com | www.00778v.com | www.weinisirenbet.com | www.r32126.cc | mg437777.com | 62222w.com | 55cc.com | www.34788v.com | www.616777a.com | www.ya2019o.com | www.js69111.com | www.9560gg.com | 1468.com | www.97828v.vip | www.808888j.com | www.ms8873.com | www.gh0092.com | xpj6620.com | 78782325.com | 6613633.com | 667766g.com | www.530255.com | www.3890i.com | www.13434f.com | www.06387799.com | www.79500z.com | www.hg88996.com | www.v2808.com | xpj55658.com | 28839y.com | 8538o.com | 8722llll.com | 058789.com | 44488r.com | www.106517.com | www.652699.com | www.7782g.com | www.4323e.com | www.zzyl61.com | www.y063801.com | www.4694t.com | www.3211msc.com | www.cdzzcx.com | www.9679d.com | www.bet365601.com | 4637700.com | 56988n.vip | 8381l.com | 87680h.com | 3614w.com | 667766s.com | 4123oo.com | 3169r.com | 4195aa.com | 11170011.com | hr499.com | 59964tt.com | www.113669.com | www.346011.com | www.581166.com | www.746133.com | www.951816.com | www.hr3888.com | www.07czj.com | www.055cp.cc | www.2875q.com | www.6364n.com | www.5095a.com | www.9818b.cc | www.15199.cc | www.3478p.cc | www.88ac.com | www.hm3666.com | www.993572.com | www.962387.com | www.810715.com | www.690477.com | www.560652.com | www.374511.com | www.188712.com | www.62118a.com | qq365t.com | q72227.com | jbb42.cc | 5906hh.com | 5360m.com | hg12020.com | 5429r.com | 137.vg | 0419g.com | yhdhz.com | iii3405.com | 3651266.com | 56988w.vip | 4379b.com | www.zs1199.com | www.gef777.com | www.b3650.com | www.929777.com | www.hgw675.com | www.5049k.com | www.4136a.com | www.4196w.com | www.9988kcd.com | www.6939g.com | www.52303d.com | www.11ttz.com | www.681968.com | www.168767.com | le888r.com | 1335h.com | ee38648.com | 51133n.com | 8905a.com | www.8520t.com | www.8694q.com | www.yz026.com | www.ns1122.com | www.00773f.com | www.xpj8896.com | www.866471.com | www.055v.cc | www.588980.com | 7720x.com | 3775x.com | 095.com | bwin8b.com | www.033033m.com | www.114suncity.com | www.190089.com | www.5446tt.com | www.1764l.com | www.41518x.com | www.725898.com | jianwei.com | tt444000.com | 9068ee.com | 55tt8331.com | www.21365mm.com | www.hg8201.com | www.9170113.com | www.2418g.com | www.qilc5.com | www.022174.com | js66661.com | hg10v.com | 923560.com | www.8455z.com | www.563736.com | www.2234.cc | www.15855.cc | www.218195.com | 3559ee.com | vvv40033.com | 389988.com | www.pj8689.com | www.hyi9.com | www.7714v.com | www.646959.com | 228888n.com | 3679pp.com | ms024.com | www.bet611.com | www.4996xm.com | www.77803p.com | www.382688.com | youfa111.vip | 8381gg.com | www.7669c.net | www.wz2255.com | www.23456789.pw | www.hx1181.com | 4997k.com | 7726zzz.com | www.56733y.com | www.004433.com | www.ba304.com | www.022hk.cc | 4260022.com | 77260022.com | www.mg4355888.com | www.xw3344.com | www.1434i.com | www.855271.com | 9978611.com | dh0853.com | www.21365tt.com | www.89599n.com | www.60108q.com | www.66653v.com | 955.com | www.56733j.com | www.hg99398.com | www.1358001.com | www.426060.com | 5856k.com | 3178v.com | www.msc22.com | www.14341434.com | www.652291.com | 653518.com | 3187.com | www.yyyy0066.com | www.2418g.com | www.234297.com | 223536.com | www.gh0092.com | www.7779833.com | www.54400s.com | buyu.com | 9339999m.com | www.js9997.com | www.38775gg.com | www.677879.com | 97297g.com | www.86611x.com | www.cp55.com | www.5441h.com | 9895u.com | t3144.com | www.pj2348.com | www.txedz.com | 65005l.com | 6118d.com | www.246123.com | www.37377k.com | www.32123e.com | yabo1188.com | www.bmw8555.com | www.48330o.com | www.97655e.com | 1489a.com | www.585234.com | www.680508.com | dzyy634.com | 28288o.com | www.44488807.com | www.51515c.com | 9964k.com | 01234jjj.com | www.50999d.com | www.al5888.com | 3421o.com | www.32126l.net | www.4546800.com | www.284488.com | 82365x.com | www.508814.com | www.52072j.com | bb5002.com | www.vns20033.com | www.7893w36.com | www.560672.com | 40033aa.com | www.y0001.cc | www.68568j.com | 4255q.com | www.hgw2088.net | www.533880.com | www.310477.com | 80368bb.com | www.2302327.com | www.11csj.com | 2381o.com | www.vns8489.com | www.yun879.com | 11001468.com | www.hg18518.com | www.wns123d.com | x7742.com | y2306.com | www.5981h.com | www.327526.com | 998r.cc | www.314996.com | www.669350.com | 9879733.com | www.e0437.com | www.853530.com | 35222f.com | www.hjcp8.com | www.719113.com | 1708222.com | www.948.com | www.620958.com | 2905.com | www.4963t.com | www.336440.com | 22pp8332.com | www.bwinyz04.com | www.040416.com | 2060055.com | www.hg33395.com | 7935a.com | www.767775.com | www.9989577.com | 2381w.com | www.32666c.com | www.26299y.com | 44hg.cc | www.dbz9.com | www.675686.com | js004.com | www.3116g.com | icesnow.com.cn | www.4495h.com | www.4331p.com | 6063331.com | www.11p1.cc | www.am7588.com | 9339999i.com | www.5981q.com | m88bc.com | www.333222h.com | www.866365.Com | 500000357.com | www.44470.com | www.659789.com | 6175oo.com | www.w84n.com | 6220.com | www.333089.com | www.361gc.com | zzylc2.com | www.5981a.com | 500000897.com | www.7620679.com | www.26163z.com | 2324qqq.com | www.28000o.com | 52599j.com | www.hgbet66.com | www.55587.com | ff3336.com | www.hg6668.tv | 5446gg.com | www.330099h.com | www.hx1181.com | jbb93.cc | www.519095.com | 44559193.com | www.bmw9968.com | www.196039.com | www.hg5857.com | www.23636m.com | 4255aaa.com | www.w84k.com | 1697766.com | www.79888.com | 60540055.com | www.b22365.com | www.aa3126.com | 02dd.cc | www.ag.hg3005.tw | 4255ii.com | www.00778y.com | 0612h.com | www.449555.com | c00351.com | www.zr305.com | www.640118.com | www.8520n.com | www.36166z.com | 505503.com | www.1466i.com | 3890q.com | www.69567p.com | 8881480.com |