'vb.net'에 해당되는 글 22건

(vb.net) 문자열 함수 Split

vb.net
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

       Dim strTest As String = "123;456;789"
       Dim strArr() As String = strTest.Split(";")

        MsgBox(strArr(0) & "  " & strArr(1) & "  " & strArr(2))

End Sub
Name
Password
Homepage
Secret

(vb.net) Lable, TextBox를 연속된 배열로 사용(vb에서 같은 이름 컨트롤들로 인덱스 다르게 할때와 동일)

vb.net
        'RadioButton1.Checked = False
        'RadioButton2.Checked = False
        'RadioButton3.Checked = False
        'RadioButton4.Checked = False
        'RadioButton5.Checked = False
        'RadioButton6.Checked = False

위 코드는 아래 코드와 동일하다


        Dim rButton() As RadioButton = {RadioButton1, RadioButton2, RadioButton3, RadioButton4, RadioButton5, RadioButton6}

        For i As Integer = 0 To 1 Step +1
            rButton(i).Checked = False

        Next

Name
Password
Homepage
Secret

(vb.net) TextBox에 입력 제한

vb.net
1. 영문입력시 대문자로만 입력되게 하기: 속성에서 CharacterCasting을 Upper로 설정
2. 영문과 숫자만 입력되게 하기: 속성에서 ImeMode를 Disable로 설정
3.숫자만 입력되게 하려면 코드창에서 텍스트박스의 KeyPress 이벤트를 만들고 다음과 같이 입력하면 된다.

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As _ System.Windows.Forms.KeyPressEventArgs) Handles tbSticks.KeyPress
        If Not Char.IsDigit(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
            e.Handled = True
        End If
    End Sub


텍스트 박스에 입력되는 숫자와 문자중 숫자만 추출

  Function ExtractNumber(ByVal InputString As String)
        Dim i As Integer = 0
        Dim Num As String = ""


        For i = Len(InputString) To 1 Step -1
            If IsNumeric(Mid(InputString, i, 1)) Then
                Num = Mid(InputString, i, 1) & Num
            End If
        Next i

        ExtractNumber = Num
    End Function
Name
Password
Homepage
Secret

(vb.net) textBox에서 엔터키를 눌렀을때 버튼 클릭 이벤트 발생

vb.net
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As _ system.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Return Then
                  Button1_Click(sender, New System.EventArgs())
        End If
    End Sub
Name
Password
Homepage
Secret

(vb.net) 명명 접두어(prefix)

vb.net
Check box - chk
Combo box - cbo
Button - btn
Form - frm
Group box - grp
Label  - lbl
List box - lst
Masked text box - msk
Radio button - rdb
Picture box - pic
Tab control - tab
Text box - txt
Timer - tmr



bckgrndWrkr = BackgroundWorker
bndgNvgtr = bindingNavigator
btn = Button
chkBx or chckBx = CheckBox
chkdLstBx or chckLstBox = CheckedListBox
clrDlg = ColorDialog
cmbBx = ComboBox
cntxtMnStrp = ContextMenuStrip
xtlRptVwr = CrystalReportViewer
dtGrdVw = DataGridView
dtSt =DataSet
dtTmPckr = DateTimePicker
dirNtry = DirectoryEntry
dirSrchr = DirectorySearcher
dmnUpDwn = DomainUpDown
errPrvdr = ErrorProvider
evLg = EventLog
flSysWtchr = FileSystemWatcher
flwLytPnl = FlowLayoutPanel
fldrBrwsrDlg = FolderBrowserDialog
fntDlg = FontDialog
grpBx = GroupBox
hlpPrvdr = HelpProvider
hScrlBr = HScrollBar ( HorizontalScrollBar )
imgLst = ImageList
lbl = Label
lnkLbl = LinkLabel
lstBx = ListBox
lstVw = ListView
mskdTxtBx = MaskedTextBox
mnuStrp = MenuStrip
msgQ = MessageQueue
mnthClndr = MonthCalendar
ntfyIcn = NotifyIcon
numUpDwn = NumericUpDown
opnFlDlg = OpenFileDialog
pgStupDlg = PageSetupDialog
pgsBr = ProgressBar
pnl = Panel
pntr = Pointer
perfCntr = PerformanceCounter
picBx = PictureBox
prntDlg = PrintDialog
prntDoc = PrintDocument
prntPrvwCntrl = PrintPreviewControl ( you could use prntPrvwC )
prntPrvwDlg = PrintPreviewDialog ( or prntPrvD )
prcs = Process
prgsBr = ProgressBar
prptGrd = Propertygrid

rdoBtn or just rBtn = RadioButton
rTxtBx or rchTxtBx = RichTextBox
rptDmt or rptDoc = ReportDocument
rptVwr = ReportViewer
rchTxtBx = RichTextBox
svFlDlg = SaveFileDialog
srlPrt = SerialPOrt
srvcCntrlr = ServiceController
spltCntr = SplitContainer
spltr = Splitter
stsStrp = StatusStrip
tbCntrl = TabControl
tblLytPnl = TableLayoutPanel
txtBx or txtBox = TextBox
tmr = Timer
tlStrp = ToolStrip
tlStrpCntr = ToolStripContainer
tTp or tTip = ToolTip
trkBr or trkBar = TrackBar
trVw = TreeView
vScrlBr = VScrollBar ( VerticalScrollBar )
wbBrwsr = WebBrowser
Name
Password
Homepage
Secret