VB.NET

.NET

DateTimePicker – reset focus

1

Code Snippet – C#

        private void dateTimePicker1_Enter(object sender, EventArgs e)
        {
            DateTimePickerFormat fmt = dateTimePicker1.Format;

            dateTimePicker1.Format = DateTimePickerFormat.Long;
            dateTimePicker1.Format = DateTimePickerFormat.Custom;
            dateTimePicker1.Format = fmt;
        }

Code Snippet - VB.NET


    Private Sub DateTimePicker1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.Enter
        Dim fmt As DateTimePickerFormat = DateTimePicker1.Format

        DateTimePicker1.Format = DateTimePickerFormat.Long
        DateTimePicker1.Format = DateTimePickerFormat.Custom
        DateTimePicker1.Format = fmt
    End Sub
.NET

Auto Complete ComboBox – VB.NET Windows Forms

3

Introduction

This is a simple code snippet which is used to make an Auto Complete ComboBox.

Using the code

Usage: Call the subroutine from within the ComboBox’s KeyPress event handler.


AutoComplete(ByRef cb As ComboBox, ByVal e As System.Windows.Forms.KeyPressEventArgs, Optional ByVal blnLimitToList As Boolean = False)
  • cb – ComboBox used to make the Auto Complete ComboBox.

More >

.NET

Storing and retrieving Images from Access database using VB.Net

5

 

Introduction

This is a simple code snippet which is used to store and retrieve images from Access database using VB.net.

Code


    Private Sub ShowDetails()
        Try
            Dim cn As New OleDb.OleDbConnection
            Dim cmd As OleDb.OleDbCommand
            Dim dr As OleDb.OleDbDataReader

            cn.ConnectionString = mstrConnection
            cn.Open()

            cmd = cn.CreateCommand()
            cmd.CommandText = "SELECT I_Image FROM tblImage WHERE I_Name = '" & cbI_Name.Text & "'"

            dr = cmd.ExecuteReader

More >

Go to Top