0% found this document useful (0 votes)
43 views

Belajar Visual Basic 2013 by Widya: Public Class Private Sub As Object As Handles

This document describes code in Visual Basic 2013 that takes text input from a text box, displays it in a label and adds it to a list box. It also clears the list box items when the list box is clicked. The code sets the text box cursor to the start of the text on each change to select all of the text.

Uploaded by

B Widya Oktaria
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Belajar Visual Basic 2013 by Widya: Public Class Private Sub As Object As Handles

This document describes code in Visual Basic 2013 that takes text input from a text box, displays it in a label and adds it to a list box. It also clears the list box items when the list box is clicked. The code sets the text box cursor to the start of the text on each change to select all of the text.

Uploaded by

B Widya Oktaria
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Public Class Form1

Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click



'lbloutput.Text = "Hello Wolf"
lbloutput.Text = txtinput.Text 'masukkan text input ke label
lboutput.Items.Add(txtinput.Text)

MsgBox("Cuba-cuba ajah" & txtinput.Text)

End Sub

Private Sub lbloutput_Click(sender As Object, e As EventArgs)

End Sub

Private Sub lboutput_SelectedIndexChanged(sender As Object, e As EventArgs)
Handles lboutput.SelectedIndexChanged
lboutput.Items.Clear() 'menghapus ketika listbox di klik
End Sub


Private Sub txtinput_TextChanged(sender As Object, e As EventArgs) Handles
txtinput.TextChanged
txtinput.SelectionStart = 0 'cursor di karakter ke 0 (pertama)
txtinput.SelectionLength = txtinput.Text.Length 'pilih semua text

End Sub
BELAJAR VISUAL BASIC 2013
By Widya
Hasil : Karakter dimasukkan melalui kotak putih (txtinput) berupa 1 karakter. Lalu
dikirim ke label dan list box.













Jika perintah ini dicomment:
txtinput.SelectionStart = 0 'cursor di karakter ke 0 (pertama)

maka :


Kalo kotak biru diklik, terhapus textnya









DAY 2
29/04/14

You might also like