Command Button Object Common Properties

Window Application में TextBox व Label Controls के बाद यदि कोई Control सबसे ज्यादा Use किया जाता है, तो वह CommandButton Control है। Command Button का मुखय काम उस समय Code Procedure को Run करना होता है, जब User Command Button पर Click करता है। जब हम Command Button को Program कर रहे होते हैं, तब हमें Command Button की निम्न मुखय Properties का ध्यान रखना होता हैः

Caption Property

हमें CommandButton के Caption Property को हमेंशा Valid नाम Set करना होता है, क्योंकि Caption Property वह Property होती है, जो Run Time में Object पर दिखाई देती है। इस Property को Design Time व Run Time दोनों स्थितियों में Access किया जा सकता है।

Cancel Property

Command Button की Cancel Property एक Boolean Property होती है। ये Property Form पर स्थित किसी एक Command Button के Click Event Procedure Codes को Esc Key द्वारा Access करने की सुविधा देता है। हम जिस Button पर Cancel Property को True Set करते हैं, उस Button के Click Event के लिए लिखे गए Codes Keyboard पर स्थित Esc Key को Press करके Execute किया जा सकता है।

ध्यान रखें कि Esc Button को Press करने पर Click Event Fire नहीं होता है, केवल Click Event Handle करने वाला Procedure ही Run होता है। सबसे ज्यादा Notice करने वाली बात ये है कि Esc Key के Press करने पर Click Event Procedure के Execute होने के बावजूद Focus की Position उस Command Button पर Change नहीं होती है, जिसका Click Event Procedure Run हो रहा है।

Default Property

Default Property भी Cancel Property की तरह ही एक Boolean Property होती है और Form पर स्थित केवल एक ही Control के लिए Default Property को True Set किया जा सकता है। ये Property भी ठीक Cancel Property की तरह ही काम करता है, अन्तर केवल इतना है कि जिस Button पर Default Property को Set किया जाता है, उसका Click Event Handler Procedure उस समय Execute हो जाता है, जब User Keyboard से Enter Key को Press करता है।

हम एक Form पर केवल एक ही Button के लिए Cancel व Default Property को True Set कर सकते हैं, Form पर स्थित शेष सभी Commands के लिए Automatically ये Properties False Set हो जाती हैं। यदि हम चाहें तो Form पर स्थित किसी एक ही Button के लिए ये दोनों Properties True Set कर सकते हैं, इस स्थिति में Esc व Enter दोनों ही Keys को Press करने पर हर बार उसी Command Button का Click Event Procedure Execute होता है।

BackColor Style and Picture Property

Command Button की एक BackColor Property भी होती है, लेकिन ये Property उसी स्थिति में Effect दिखाती है, जब हम Command Button की Style Property को “1 – vbGraphical” Set करते हैं। जब हम ये Style Set करते हैं, तो उसके बाद हम Command Button की Picture Property को Set करके Command Button पर किसी Graphical Image को भी Display कर सकते हैं।

Value Property

Value Property Command Button की Default Property होती है और ये केवल Run Time में ही Available होती है। यदि हम इसकी Value Property को True Set कर देते हैं, तो Command Button का Click Event Procedure Execute हो जाता है। Command Button के Click Event Procedure को Execute करने के लिए हमें Command Button की इस Default Property को True Set करना होता है, जो कि निम्नानुसार दो तरीकों से किया जा सकता हैः

cmdOK = True         OR          cmdOK.Value = True

Visual Basic 6 in Hindiये Article इस वेबसाईट पर Selling हेतु उपलब्‍ध EBook Visual Basic 6 in Hindi से लिया गया है। इसलिए यदि ये Article आपके लिए उपयोगी रहा, तो निश्चित रूप से ये पुस्तक भी आपके लिए काफी उपयोगी साबित होगी। 

Visual Basic 6 in Hindi | Page: 175 | Format: PDF

BUY NOW GET DEMO REVIEWS