IDE

Visual Studio workshop है: screen draw करने के लिए form designer, controls drag करने के लिए Toolbox, इन्हें configure करने के लिए Properties window, और एक double-click जो आपको event के code में drop कर देता है।

10 min read · 10 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

एक Program जिसे आप Draw कर सकते हैं

आपके BCA में अब तक हर program, C से Java तक, same तरीके से born हुआ: एक blank text file।

आज अलग है। आप ShopKeeper की पहली window draw करके बनाएँगे: एक palette से एक button drag कीजिए, इसे एक window पर drop कीजिए, अपने mouse से इसे resize कीजिए। Code अभी भी exist करता है, पर screen के layout के लिए आप एक designer की तरह काम करते हैं, typist की तरह नहीं।

Workshop जो यह possible बनाता है Visual Studio IDE है, और इसके 4 main panels जानना यही lesson है।

Theory

4 Panels, Formally

एक IDE (Integrated Development Environment) editor, designer, compiler और debugger को एक tool में bundle करता है। Visual Studio का Windows-Forms workspace exam में नाम लेने के लिए 4 panels रखता है:

  • Form Designer: canvas; आपकी window जैसी यह दिखेगी
  • Toolbox: controls का palette (Button, TextBox, Label...) जिन्हें आप form पर drag करते हैं
  • Properties Window: selected control की हर setting: इसका Name, Text, size, colour; plus इसकी events की list
  • Solution Explorer: project की files

Follow along

ShopKeeper की पहली Window, Click by Click

  1. File, New, Project: Windows Forms App (Visual Basic) इसे ShopKeeper नाम दीजिए। Visual Studio Form1 को designer में खोलता है।
  2. Toolbox से एक Button को form पर Drag कीजिए यह Button1 की तरह land होता है। Shop के नाम के लिए एक Label भी drag कीजिए।
  3. Properties Window में Properties Set कीजिए Button select कीजिए: Name = btnWelcome, Text = Welcome। Code से PEHLE meaningful names: btnTotal, txtItem, lblBill।
  4. Button को Double-Click कीजिए Visual Studio code view पर jump करता है और आपके लिए btnWelcome_Click event handler generate करता है।
  5. इसके अंदर एक Line लिखिए, फिर F5 Press कीजिए MsgBox("Welcome to Mehta Stores")। F5 debugger से build और run करता है; button click कीजिए और box appear होता है।

Practical

Double-Click ने क्या Generate किया (plus आपकी line)

Public Class Form1

    Private Sub btnWelcome_Click(sender As Object, e As EventArgs) _
            Handles btnWelcome.Click
        MsgBox("Welcome to Mehta Stores")
    End Sub

End Class

Theory

एक Form के दो Views

समझिए double-click ने क्या reveal किया: आपकी form 2 views में रहती है।

Designer view दिखाता है window कैसी DIKHTI है। Code view दिखाता है यह कैसे BEHAVE करती है। वे same Form1 describe करते हैं; form पर right-click कीजिए और View Code / View Designer इनके बीच switch करता है।

Generated method की tail matter करती है: Handles btnWelcome.Click VB.NET की wiring है, declare करते हुए कि यह Sub तब भी run होता है जब भी वह button click होता है। यह event-driven style (code user का wait करता है) desktop पर BCA305-02 का Android pattern है।

Quiz

आपने ShopKeeper का button select किया और चाहते हैं इसकी caption Button1 के बजाय Total कहे। वह change कहाँ होता है?

  1. Text property, Properties window में
  2. Name property, Properties window में
  3. Toolbox में Button की entry edit कीजिए
  4. यह सिर्फ़ run time पर code में बदला जा सकता है
Show the answer

Text property, Properties window में

Text वह है जो user control पर पढ़ता है; इसे Properties window में बदलना designer को instantly update करता है। Name (option B) वह identifier है जो CODE इस्तेमाल करता है, btnTotal, user को invisible: Text/Name split exam का favourite IDE question है। Toolbox (option C) control TYPES का palette है; इसे edit करना आपके form पर कुछ नहीं बदलता। Option D at best half-true है: run-time changes possible हैं (btnTotal.Text = "Total"), पर design time exactly वह है जिसके लिए Properties window है।

Think first

Misfire Predict कीजिए

एक classmate FORM के खुद के एक empty area को double-click करता है, button को नहीं, और MsgBox line जो भी खुला उसमें type कर देता है। Program run होता है, पर click पर box कभी appear नहीं होता। क्या हुआ, और box कब appear HOGA?

Show the answer

एक control को double-click करना इसके DEFAULT event का handler generate करता है, और form का default event Click नहीं, Load है। MsgBox line Form1_Load में land हुई, जो एक बार run होता है, जब window खुलती है: तो box startup पर appear होता है और button पर कभी नहीं। Fix: वहाँ इसे delete कीजिए, BUTTON double-click कीजिए, और line को btnWelcome_Click में डालिए। रखने लायक rule: कुछ भी type करने से पहले हमेशा generated Sub का name और Handles clause पढ़िए।

Watch out

Habits जो Future Marks (और Hair) बचाती हैं

Controls को Immediately Name कीजिए: 12 controls को Button1..Button12 छोड़िए और अगले week का code unreadable होगा। btnTotal, txtQty, lblAmount, dgvBill: prefix + meaning।

Designer-Generated Region को हाथ से Edit मत कीजिए: designer के लिए Visual Studio ने जो layout code लिखा वह hand-mangled होने पर टूटता है; designer और Properties window से form बदलिए।

F5 बनाम Build: F5 = debugger के साथ build AND run; एक red-underlined error list का मतलब है यह असल में कभी run नहीं हुआ।

Theory

Room Ready है

अब आप workshop जानते हैं: canvas, palette, settings panel, file tree, और एक form के 2 views। Unit 3 जो कुछ भी करती है यही loop repeated है: एक control drag कीजिए, इसे name दीजिए, properties set कीजिए, इसके events handle कीजिए। पर यहाँ और वहाँ के बीच, ShopKeeper को अपना brain चाहिए: VB.NET में खुद variables, calculations और decisions। यही Unit 2 का बाकी हिस्सा है, data types और Dim statement से शुरू होते हुए।

Summary

Key takeaways

  • IDE = एक में editor + designer + compiler + debugger; Visual Studio .NET का है।
  • चार panels: form designer (canvas), Toolbox (control palette), Properties window (settings + events), Solution Explorer (files)।
  • Flow: नया Windows Forms project, controls drag कीजिए, Name और Text set कीजिए, double-click कीजिए, code, F5।
  • Text वह है जो users देखते हैं; Name वह है जो code इस्तेमाल करता है: पहले meaningful names set कीजिए।
  • Double-click control के DEFAULT event handler generate करता है; form का Load है, एक button का Click है।
  • Handles एक Sub को एक event से wire करता है: desktop cousin BCA305-02 के Android listeners का।
  • Memory hook: screen draw कीजिए, parts को name दीजिए, behaviour में double-click कीजिए।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Programming in Visual Basic .NET

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

IDE · .NET Programming · Gri-Learn