SlideShare a Scribd company logo
1 of 5
Download to read offline
VB .NET 2005 By Warawut Khangkhan



                        ตวอยาง การใช ListBox และ ComboBox Control
ตวอยาง การใช ListBox และ ComboBox Control
                                                      1
                                             3                4               5              6           7         8
                            2

                                                                                               Label Control
                                                                                             Name: lblAmountList
       9                                  Label Control
                                    Name: lblAmountComboBox                                 11
                                                                                            12
                Label Control
                                               10
           Name: lblIndexComboBox                                         Label Control
                                                                       Name: lblIndexListBox


                                                                                  13
                                                                                       14              15



ตาราง การก,าหนด Properties ท45สาค8ญแต:ละ Control
                               ,
 No.        Control                      Properties                                         Values
  1 Form                   Name                                   Form1
                           StartPosition                          CenterScreen
                           Text                                   Example Using ListBox and ComboBox Control
  2 TextBox                Name                                   TextBox1
  3 Button                 Name                                   Button1
                           Text                                   Add Text
  4 Button                 Name                                   Button2
                           Text                                   Clear Text
  5 Button                 Name                                   Button5
                           Text                                   Run Number




                                                          -1-
VB .NET 2005 By Warawut Khangkhan


ตาราง การก,าหนด Properties ท45สาค8ญแต:ละ Control (ต:อ)
                               ,
 No.        Control                    Properties                               Values
  6 NumericUpDown          Name                                NumericUpDown1
                           Maximum                             10
                           Minimum                             1
  7 NumericUpDown          Name                                NumericUpDown2
                           Maximum                             10
                           Minimum                             1
  8 NumericUpDown          Name                                NumericUpDown3
                           Maximum                             10
                           Minimum                             1
  9 ComboBox               Name                                ComboBox1
                           DropDownStyle                       DropDownList
 10 ListBox                Name                                ListBox1
 11 Button                 Name                                Button4
                           Text                                RemoveAt
 12 Button                 Name                                Button6
                           Text                                Remove
 13 TextBox                Name                                TextBox2
 14 TextBox                Name                                TextBox3
 15 Button                 Name                                Button3
                           Text                                Insert Text




                                                         -2-
VB .NET 2005 By Warawut Khangkhan


Coding:
Public Class Form1

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     ComboBox1.Items.Add(TextBox1.Text.Trim)
     ListBox1.Items.Add(TextBox1.Text.Trim)
     lblAmountList.Text = ListBox1.Items.Count
     lblAmountComboBox.Text = ComboBox1.Items.Count
     TextBox1.Focus()
  End Sub

  Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
     TextBox1.SelectionStart = 0
     TextBox1.SelectionLength = TextBox1.Text.Length
  End Sub

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
     ComboBox1.Items.Clear()
     ListBox1.Items.Clear()
     lblAmountList.Text = "0"
     lblAmountComboBox.Text = "0"
     lblIndexComboBox.Text = "0"
     lblIndexListBox.Text = "0"
     TextBox1.Focus()
  End Sub

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     lblAmountList.Text = "0"
     lblAmountComboBox.Text = "0"
     lblIndexListBox.Text = "0"
     lblIndexComboBox.Text = "0"
  End Sub

   Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ListBox1.SelectedIndexChanged
      lblIndexListBox.Text = ListBox1.SelectedIndex + 1
   End Sub

  Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
     lblIndexComboBox.Text = ComboBox1.SelectedIndex + 1
  End Sub

  Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
     If Convert.ToInt32(TextBox3.Text) >= 0 And Convert.ToInt32(TextBox3.Text) <= ListBox1.Items.Count Then
        If Convert.ToInt32(TextBox3.Text) = 0 Then
           ListBox1.Items.Insert(TextBox3.Text, TextBox2.Text)
        Else
           ListBox1.Items.Insert(TextBox3.Text - 1, TextBox2.Text)
        End If
     Else




                                                            -3-
VB .NET 2005 By Warawut Khangkhan


       MessageBox.Show("ระบรายการททาไมถกตอง", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
       TextBox3.Focus()
    End If
    lblAmountList.Text = ListBox1.Items.Count
  End Sub

  Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.Enter
     TextBox3.SelectionStart = 0
     TextBox3.SelectionLength = TextBox3.Text.Length
  End Sub

  Private Sub TextBox2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter
     TextBox2.SelectionStart = 0
     TextBox2.SelectionLength = TextBox2.Text.Length
  End Sub

  Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles
TextBox3.KeyPress
     If e.KeyChar < "0" Or e.KeyChar > "9" Then
       e.Handled = True
     End If
  End Sub

  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
     If ListBox1.SelectedIndex < 0 Then Exit Sub
     ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
     lblAmountList.Text = ListBox1.Items.Count
  End Sub

  Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
     Dim i As Integer

    If NumericUpDown1.Value > NumericUpDown2.Value Then
       MessageBox.Show("Start ตองนอยกวา Stop", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
       NumericUpDown1.Focus()
       Exit Sub
    End If
    ListBox1.Items.Clear()
    lblAmountList.Text = "0"
    lblAmountComboBox.Text = "0"
    lblIndexListBox.Text = "0"
    lblIndexComboBox.Text = "0"

    For i = NumericUpDown1.Value To NumericUpDown2.Value Step NumericUpDown3.Value
      ListBox1.Items.Add("Number " & i)
    Next

    lblAmountList.Text = ListBox1.Items.Count
  End Sub




                                                            -4-
VB .NET 2005 By Warawut Khangkhan


  Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
     If ListBox1.SelectedIndex < 0 Then Exit Sub
     ListBox1.Items.Remove(ListBox1.SelectedItem)
     lblAmountList.Text = ListBox1.Items.Count
  End Sub
End Class




                                                            -5-

More Related Content

What's hot

Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Trisha Gee
 
C++ Windows Forms L07 - Collections
C++ Windows Forms L07 - CollectionsC++ Windows Forms L07 - Collections
C++ Windows Forms L07 - CollectionsMohammad Shaker
 
Python functions
Python functionsPython functions
Python functionsToniyaP1
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Kuldeep Jain
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196Mahmoud Samir Fayed
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharpCreating Lazy stream in CSharp
Creating Lazy stream in CSharpDhaval Dalal
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180Mahmoud Samir Fayed
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
Introduction to Python - Part Two
Introduction to Python - Part TwoIntroduction to Python - Part Two
Introduction to Python - Part Twoamiable_indian
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarROHIT JAISWAR
 

What's hot (16)

Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)
 
C++ Windows Forms L07 - Collections
C++ Windows Forms L07 - CollectionsC++ Windows Forms L07 - Collections
C++ Windows Forms L07 - Collections
 
Python functions
Python functionsPython functions
Python functions
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Java File
Java FileJava File
Java File
 
Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.Chat application in java using swing and socket programming.
Chat application in java using swing and socket programming.
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196
 
Creating Lazy stream in CSharp
Creating Lazy stream in CSharpCreating Lazy stream in CSharp
Creating Lazy stream in CSharp
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180The Ring programming language version 1.5.1 book - Part 24 of 180
The Ring programming language version 1.5.1 book - Part 24 of 180
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Introduction to Python - Part Two
Introduction to Python - Part TwoIntroduction to Python - Part Two
Introduction to Python - Part Two
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Java misc1
Java misc1Java misc1
Java misc1
 
Ejb3 Dan Hinojosa
Ejb3 Dan HinojosaEjb3 Dan Hinojosa
Ejb3 Dan Hinojosa
 
Java Lab Manual
Java Lab ManualJava Lab Manual
Java Lab Manual
 

Similar to การใช้ ListBox และ ComboBox Control

Vb6 ch.7-3 cci
Vb6 ch.7-3 cciVb6 ch.7-3 cci
Vb6 ch.7-3 cciFahim Khan
 
Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012yantoit2011
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
 
Ebook Pembuatan Aplikasi Rental film 2012
Ebook Pembuatan Aplikasi Rental film 2012Ebook Pembuatan Aplikasi Rental film 2012
Ebook Pembuatan Aplikasi Rental film 2012yantoit2011
 
Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008atsumagaysay
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding ManualVizwik
 
Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3sunmitraeducation
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
Basic controls in asp
Basic controls in aspBasic controls in asp
Basic controls in aspSireesh K
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84Mahmoud Samir Fayed
 
Lampiran source code
Lampiran source codeLampiran source code
Lampiran source codeancunk
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Introtodotnet
IntrotodotnetIntrotodotnet
Introtodotnetrashmix
 
IntroToDotNetTech
IntroToDotNetTechIntroToDotNetTech
IntroToDotNetTechrashmix
 

Similar to การใช้ ListBox และ ComboBox Control (20)

Vb6 ch.7-3 cci
Vb6 ch.7-3 cciVb6 ch.7-3 cci
Vb6 ch.7-3 cci
 
Richtextbox
RichtextboxRichtextbox
Richtextbox
 
Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88
 
Ebook Pembuatan Aplikasi Rental film 2012
Ebook Pembuatan Aplikasi Rental film 2012Ebook Pembuatan Aplikasi Rental film 2012
Ebook Pembuatan Aplikasi Rental film 2012
 
Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008Binary Search Program in Visual Basic 2008
Binary Search Program in Visual Basic 2008
 
Vizwik Coding Manual
Vizwik Coding ManualVizwik Coding Manual
Vizwik Coding Manual
 
Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3Visual Web Developer and Web Controls VB set 3
Visual Web Developer and Web Controls VB set 3
 
Inventory management
Inventory managementInventory management
Inventory management
 
Colegio municipal
Colegio municipalColegio municipal
Colegio municipal
 
Basic controls in asp
Basic controls in aspBasic controls in asp
Basic controls in asp
 
Delphi L02 Controls P1
Delphi L02 Controls P1Delphi L02 Controls P1
Delphi L02 Controls P1
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84The Ring programming language version 1.2 book - Part 11 of 84
The Ring programming language version 1.2 book - Part 11 of 84
 
Lampiran source code
Lampiran source codeLampiran source code
Lampiran source code
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Ficha tecnica
Ficha tecnicaFicha tecnica
Ficha tecnica
 
Visual basic
Visual basicVisual basic
Visual basic
 
Introtodotnet
IntrotodotnetIntrotodotnet
Introtodotnet
 
IntroToDotNetTech
IntroToDotNetTechIntroToDotNetTech
IntroToDotNetTech
 

More from Warawut

Database design
Database designDatabase design
Database designWarawut
 
Business Computer Project 4
Business Computer Project 4Business Computer Project 4
Business Computer Project 4Warawut
 
Object-Oriented Programming 10
Object-Oriented Programming 10Object-Oriented Programming 10
Object-Oriented Programming 10Warawut
 
Object-Oriented Programming 9
Object-Oriented Programming 9Object-Oriented Programming 9
Object-Oriented Programming 9Warawut
 
Object-Oriented Programming 8
Object-Oriented Programming 8Object-Oriented Programming 8
Object-Oriented Programming 8Warawut
 
Object-Oriented Programming 7
Object-Oriented Programming 7Object-Oriented Programming 7
Object-Oriented Programming 7Warawut
 
Object-Oriented Programming 6
Object-Oriented Programming 6Object-Oriented Programming 6
Object-Oriented Programming 6Warawut
 
Management Information System 6
Management Information System 6Management Information System 6
Management Information System 6Warawut
 
Management Information System 5
Management Information System 5Management Information System 5
Management Information System 5Warawut
 
Management Information System 4
Management Information System 4Management Information System 4
Management Information System 4Warawut
 
Object-Oriented Programming 5
Object-Oriented Programming 5Object-Oriented Programming 5
Object-Oriented Programming 5Warawut
 
Business Computer Project 3
Business Computer Project 3Business Computer Project 3
Business Computer Project 3Warawut
 
Management Information System 3
Management Information System 3Management Information System 3
Management Information System 3Warawut
 
Business Computer Project 2
Business Computer Project 2Business Computer Project 2
Business Computer Project 2Warawut
 
Chapter 2 Strategy & Information System
Chapter 2 Strategy & Information SystemChapter 2 Strategy & Information System
Chapter 2 Strategy & Information SystemWarawut
 
Object-Oriented Programming 4
Object-Oriented Programming 4Object-Oriented Programming 4
Object-Oriented Programming 4Warawut
 
Business Computer Project 1
Business Computer Project 1Business Computer Project 1
Business Computer Project 1Warawut
 
Chapter 1 Organization & MIS
Chapter 1 Organization & MISChapter 1 Organization & MIS
Chapter 1 Organization & MISWarawut
 
Object-Oriented Programming 3
Object-Oriented Programming 3Object-Oriented Programming 3
Object-Oriented Programming 3Warawut
 
Object-Oriented Programming 2
Object-Oriented Programming 2Object-Oriented Programming 2
Object-Oriented Programming 2Warawut
 

More from Warawut (20)

Database design
Database designDatabase design
Database design
 
Business Computer Project 4
Business Computer Project 4Business Computer Project 4
Business Computer Project 4
 
Object-Oriented Programming 10
Object-Oriented Programming 10Object-Oriented Programming 10
Object-Oriented Programming 10
 
Object-Oriented Programming 9
Object-Oriented Programming 9Object-Oriented Programming 9
Object-Oriented Programming 9
 
Object-Oriented Programming 8
Object-Oriented Programming 8Object-Oriented Programming 8
Object-Oriented Programming 8
 
Object-Oriented Programming 7
Object-Oriented Programming 7Object-Oriented Programming 7
Object-Oriented Programming 7
 
Object-Oriented Programming 6
Object-Oriented Programming 6Object-Oriented Programming 6
Object-Oriented Programming 6
 
Management Information System 6
Management Information System 6Management Information System 6
Management Information System 6
 
Management Information System 5
Management Information System 5Management Information System 5
Management Information System 5
 
Management Information System 4
Management Information System 4Management Information System 4
Management Information System 4
 
Object-Oriented Programming 5
Object-Oriented Programming 5Object-Oriented Programming 5
Object-Oriented Programming 5
 
Business Computer Project 3
Business Computer Project 3Business Computer Project 3
Business Computer Project 3
 
Management Information System 3
Management Information System 3Management Information System 3
Management Information System 3
 
Business Computer Project 2
Business Computer Project 2Business Computer Project 2
Business Computer Project 2
 
Chapter 2 Strategy & Information System
Chapter 2 Strategy & Information SystemChapter 2 Strategy & Information System
Chapter 2 Strategy & Information System
 
Object-Oriented Programming 4
Object-Oriented Programming 4Object-Oriented Programming 4
Object-Oriented Programming 4
 
Business Computer Project 1
Business Computer Project 1Business Computer Project 1
Business Computer Project 1
 
Chapter 1 Organization & MIS
Chapter 1 Organization & MISChapter 1 Organization & MIS
Chapter 1 Organization & MIS
 
Object-Oriented Programming 3
Object-Oriented Programming 3Object-Oriented Programming 3
Object-Oriented Programming 3
 
Object-Oriented Programming 2
Object-Oriented Programming 2Object-Oriented Programming 2
Object-Oriented Programming 2
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

การใช้ ListBox และ ComboBox Control

  • 1. VB .NET 2005 By Warawut Khangkhan ตวอยาง การใช ListBox และ ComboBox Control ตวอยาง การใช ListBox และ ComboBox Control 1 3 4 5 6 7 8 2 Label Control Name: lblAmountList 9 Label Control Name: lblAmountComboBox 11 12 Label Control 10 Name: lblIndexComboBox Label Control Name: lblIndexListBox 13 14 15 ตาราง การก,าหนด Properties ท45สาค8ญแต:ละ Control , No. Control Properties Values 1 Form Name Form1 StartPosition CenterScreen Text Example Using ListBox and ComboBox Control 2 TextBox Name TextBox1 3 Button Name Button1 Text Add Text 4 Button Name Button2 Text Clear Text 5 Button Name Button5 Text Run Number -1-
  • 2. VB .NET 2005 By Warawut Khangkhan ตาราง การก,าหนด Properties ท45สาค8ญแต:ละ Control (ต:อ) , No. Control Properties Values 6 NumericUpDown Name NumericUpDown1 Maximum 10 Minimum 1 7 NumericUpDown Name NumericUpDown2 Maximum 10 Minimum 1 8 NumericUpDown Name NumericUpDown3 Maximum 10 Minimum 1 9 ComboBox Name ComboBox1 DropDownStyle DropDownList 10 ListBox Name ListBox1 11 Button Name Button4 Text RemoveAt 12 Button Name Button6 Text Remove 13 TextBox Name TextBox2 14 TextBox Name TextBox3 15 Button Name Button3 Text Insert Text -2-
  • 3. VB .NET 2005 By Warawut Khangkhan Coding: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ComboBox1.Items.Add(TextBox1.Text.Trim) ListBox1.Items.Add(TextBox1.Text.Trim) lblAmountList.Text = ListBox1.Items.Count lblAmountComboBox.Text = ComboBox1.Items.Count TextBox1.Focus() End Sub Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter TextBox1.SelectionStart = 0 TextBox1.SelectionLength = TextBox1.Text.Length End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ComboBox1.Items.Clear() ListBox1.Items.Clear() lblAmountList.Text = "0" lblAmountComboBox.Text = "0" lblIndexComboBox.Text = "0" lblIndexListBox.Text = "0" TextBox1.Focus() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load lblAmountList.Text = "0" lblAmountComboBox.Text = "0" lblIndexListBox.Text = "0" lblIndexComboBox.Text = "0" End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged lblIndexListBox.Text = ListBox1.SelectedIndex + 1 End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged lblIndexComboBox.Text = ComboBox1.SelectedIndex + 1 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If Convert.ToInt32(TextBox3.Text) >= 0 And Convert.ToInt32(TextBox3.Text) <= ListBox1.Items.Count Then If Convert.ToInt32(TextBox3.Text) = 0 Then ListBox1.Items.Insert(TextBox3.Text, TextBox2.Text) Else ListBox1.Items.Insert(TextBox3.Text - 1, TextBox2.Text) End If Else -3-
  • 4. VB .NET 2005 By Warawut Khangkhan MessageBox.Show("ระบรายการททาไมถกตอง", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) TextBox3.Focus() End If lblAmountList.Text = ListBox1.Items.Count End Sub Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.Enter TextBox3.SelectionStart = 0 TextBox3.SelectionLength = TextBox3.Text.Length End Sub Private Sub TextBox2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter TextBox2.SelectionStart = 0 TextBox2.SelectionLength = TextBox2.Text.Length End Sub Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress If e.KeyChar < "0" Or e.KeyChar > "9" Then e.Handled = True End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If ListBox1.SelectedIndex < 0 Then Exit Sub ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) lblAmountList.Text = ListBox1.Items.Count End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim i As Integer If NumericUpDown1.Value > NumericUpDown2.Value Then MessageBox.Show("Start ตองนอยกวา Stop", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) NumericUpDown1.Focus() Exit Sub End If ListBox1.Items.Clear() lblAmountList.Text = "0" lblAmountComboBox.Text = "0" lblIndexListBox.Text = "0" lblIndexComboBox.Text = "0" For i = NumericUpDown1.Value To NumericUpDown2.Value Step NumericUpDown3.Value ListBox1.Items.Add("Number " & i) Next lblAmountList.Text = ListBox1.Items.Count End Sub -4-
  • 5. VB .NET 2005 By Warawut Khangkhan Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click If ListBox1.SelectedIndex < 0 Then Exit Sub ListBox1.Items.Remove(ListBox1.SelectedItem) lblAmountList.Text = ListBox1.Items.Count End Sub End Class -5-