• Increase font size
  • Default font size
  • Decrease font size
Visual Basic 2008

How to insert Unicode Text from VB 2008 into Table in Microsoft SQL Server?

E-mail Print PDF
This article describes about how to insert Unicode data into SQL Server 2000.
  • Take not that fields to be stored Unicode data in SQL Server Table must be nvarchar, nchar, or ntext
  • Choose Latin1_General_BIN for Collation property of each Unicode field (see image below)

  • Assume that we have one SQL Server table as below:
    Student (stdid: int, lastname: nvarchar(50), firstname: nvarchar(50))
  • Write Visual Basic .Net 2008 Code as below:
    Dim cn As New OleDb.OleDbConnection
            cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI; " & _
                                    "Data Source=.; " & _
                                    " Persist Security Info=False; Initial Catalog=Test"
            Dim cmd As New OleDb.OleDbCommand
            cmd.Connection = cn
            cmd.CommandText = "INSERT INTO student(stdid, lastname, firstname) " & _
                            " VALUES(" & Me.txtID.Text & "," & _
                            "N'" & Me.txtLastName.Text & "'," & _
                            "N'" & Me.txtFirstName.Text & "')"

How to Create Folder using Visual Basic .Net

E-mail Print PDF
Follow the below steps:
  • Create New Windows Form
  • Draw one Button on the above Windows Form
  • Write the below code in Button_Click Event
    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) Handles Button1.Click
        System.IO.Directory.CreateDirectory("C:\New Folder")
    End Sub

How to Create MDI Form and Menu Bar in Visual Basic 2008

E-mail Print PDF

This article shows you how to create MDI Form with Menu Bar in Microsoft Visual Basic 2008. From this article, you will know:

  • How to create MDI Form?
  • How to create Menu Bar?
  • How to click on each menu item to open child form in MDI form?

  1. Create MDI Form
    Create New Form (Project Menu -> Add New Item -> Windows Form)
    Change Properties of Form as below
    • WindowState: Maximized
    • isMdiContainer: True
  2. Create Menu Bar
    Drag MenuStrip Control to MDI Form
    Add Menu Item and Sub Menu Item (See in Video Below)
  3. Write Code
    Click on Menu Item to show Form in MDI Form (see example below)
            frmStudent.MdiParent = Me

See video below



E-mail Print PDF

This article shows you how to write Visual Basic code using ADO.Net to manipulate data with Microsoft Access 2003 format. From this article you will know how to:

  • Use DataGridView control to get data from database
  • Use ADO.Net to Insert, Delete, Update, and Select data in MS-Access Database
  • Use SQL Statement for Inserting, Deleting, Modifying, and Selecting Data

Download Sample Code Here
  • Create Visual Basic 2008 Project: VB-Access
  • Assume that, we have a database file named data.mdb
  • Place the data.mdb file into ..\bin\Debug\ folder
    (Where the project executable file (.exe) is placed)
  • In data.mdb, there is a table named: student which consists of the following fields
    FieldData TypeDescription
    stdidNumberStudent's ID
    stdnameTextStudent's name
    phoneTextStudent's phone number
    addressTextStudent's address
  • Create New Form: frmStudent (as in image above)
  • Write code (Download Sample Code Here)

See video below
Part 1:

Part 2:

Export Data from DataGridView in Visual Basic 2008 to Microsoft Word Table

E-mail Print PDF

This article shows you how to write code in Visual Basic 2008 to export data from DataGridView control into Microsoft Word's Table.

Dim objWordApp As Object
Dim objWordDoc As Object

objWordApp = CreateObject("Word.Application")
objWordDoc = objWordApp.documents.add()

objWordDoc.tables.add(objWordDoc.range(0, 0), 11, 3)
With objWordDoc.tables(1)
     .borders.InsideLineStyle = 1
     .borders.OutsideLineStyle = 1

     For i As Integer = 0 To 10
          .rows(i + 1).cells(1).range.text = Me.dgvData.Rows(i).Cells("id").Value
          .rows(i + 1).cells(2).range.text = Me.dgvData.Rows(i).Cells("name").Value
          .rows(i + 1).cells(3).range.text = Me.dgvData.Rows(i).Cells("gender").Value
End With

objWordApp.visible = True

objWordApp = Nothing

Download Sample Code Here

Page 4 of 6