ParsX.com
پذیرش پروژه از دانشجویی ... تا سازمانی 09376225339
 
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

یک حلقه برای چک خالی نبودن تکست باکس

 
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET
View previous topic :: View next topic  
Author Message
mazamir
مهمون يكي دو روزه


Joined: 06 Aug 2006
Posts: 12

PostPosted: Sun Aug 13, 2006 2:25 am    Post subject: یک حلقه برای چک خالی نبودن تکست باکس Reply with quote

سلام
می خوام یک کدی براتون بذارم که شاید حرفه ای نباشه ولی برای تازه کارها سودمنده. من خودم چنین مشکلی رو با دستورهای شرطی حل می کردم ولی توی بعضی مواقع بدلیل زیاد بودن تکست
باکس ها وقت گیر می شد. خب خیلی تلاش کردم و تونستم با حلقه حلش کنم:

dim controlers as new collection
dim response as integer
For Each controlers In Controls
    If TypeOf controlers Is TextBox Then
        If controlers.Text = "" Then
               response = MsgBox(controlers.Name + "  Please put text", vbCritical)
                       End If
    End If
Next

Mazamir_69@yahoo.com
Back to top
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 3067
Location: Tehran

PostPosted: Sun Aug 13, 2006 6:55 am    Post subject: Reply with quote

دستت درد نكنه كد جالبي بود .
براي msbox تا وقتي به خروجيش نياز نداري لازم نيست خروجيش رو توي متغير بريزي ، نمي دونم مي دوني يا نه اما مي توني بنويسي call msgbox يا اينكه به جاي پرانتز جلوي msgbox از دابل كوتيشن استفاده كني .
خاصيت پيشفرض Texbox هم چون text هست نيازي نيست بنويسي texbox1.text مي توني فقط بنويسي textbox1
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> ويژوال بيسيك .NET All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum