VB.Net Import Txt File Text To DataGridview

How To Populate DataGridview From a Text File Data In VB.Net

display txt file text to a datagridview using vb.net



In this VB.NET Tutorial we will see How To Get Records From .txt File And Display The Values Into DataGridView Rows On Button Click Event Using Visual Basic.Net  Programming Language And Visual  Studio Editor.




Project Source Code:


Imports System.IO

Public Class TXT_TO_DGV

    Dim table As New DataTable()
    Private Sub TXT_TO_DGV_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ' add columns to datatable
        table.Columns.Add("Id", Type.GetType("System.Int32"))
        table.Columns.Add("First Name", Type.GetType("System.String"))
        table.Columns.Add("Last Name", Type.GetType("System.String"))
        table.Columns.Add("Age", Type.GetType("System.Int32"))

        ' set the datatable as datasource
        DataGridView1.DataSource = table

    End Sub

    ' button import
    Private Sub ButtonImport_Click(sender As Object, e As EventArgs) Handles ButtonImport.Click

        Dim lines() As String
        Dim vals() As String
      
        ' get lines from the text file
        lines = File.ReadAllLines("C:\Users\1BestCsharp\Desktop\table.txt")

        For i As Integer = 0 To lines.Length - 1 Step +1  ' lines

            vals = lines(i).ToString().Split("|")
            Dim row(vals.Length - 1) As String

            For j As Integer = 0 To vals.Length - 1 Step +1  ' columns

                row(j) = vals(j).Trim()

            Next j

            table.Rows.Add(row)

        Next i


    End Sub
End Class


OutPut:

Import Text File Text To DataGridview Using VB.Net




C# Real Estate Management System Source Code

Real Estate Management System Project Source Code Using C# And MySQL Database

C# Real Estate Management System Project

in this c# complete project tutorial serie we will see how to create a real estate management system using windowForm in c# programming language and mysql database.

goals of this project:
- give students / curious persons an example so they can learn from it.
- helping people create their first project. 
- sharing knowledge with others.

tools:
- c# programming language.
- microsoft visual studio express 2013.
- mysql database.
- phpmyadmin.
- xampp server.
- pixabay.com ( website for free images ).

Watch This Full Demo




1 - The Login Form

the login form will allow the Users to login into the Real-Estate application Main Form.
the user need to enter his username and password before clicking the login button.


login form


if the user let the username or password empty an astrix will show up in the right side of the textbox.


login form 2

if the user enter wrong username or password an error message will show up telling him what's the problem.


login form 3


and if everything is ok, when the user click on the login button the main real estate management system form will show up and the login form will closed.


2 - The Real Estate System Main Project Form

after the user successfully login, he will see this main app window with a menu using panel and buttons.
the user can select where he want to go by clicking the on the item from the menu.

main form


menu
Menu Item Hover


3 - The Real Estate System , Clients Form


- this form contains a datagridview with all clients data, a label with total clients in the database.

- to add a new client enter his data and click on "Add" button.

- to edit a client you need to select him first from the datagridview and enter his new data.

- when you want to delete a client just select the client you want to remove and click on the "Remove" button.
- when you Add or Remove a client the label with clients count will be updated automatically.

manage clients form

4 - The Real Estate System Manage Owners Form


this form is 90% like the clients form

you can add, edit, remove selected owner and all the good stuff.

manage owners form

if you want to see a selected owner properties, just select the owner from the datagridview and click the "Show This Owner's Properties" button.

and you can see a label with total of properties this owner have.


owner properties

5 - The Real Estate System - Property's Types Form


in this form the user can manage the types of properties in the system.
all types are displayed in a listbox, if you select an item from the listbox it will be displayed on the textboxes.



property types

property types 2

6 - The Real Estate System , Property Form


this form contains textboxes, numericUpDown for the numeric values, checkboxes for the property features, a combobx populated  with all types,


manage property form


in this form the user can add, edit, search and remove a property.
when the user want to add/edit a property he need to select an owner for this property, and he can do that by clicking on the "Select Owner" button and a form will show allowing him to select an owner.


owners list

if the user want to search for a property all he need to do is to enter the property's id and click on the "search" button.
each property need to be assigned to a type, which can be selected form the combobox.

search property


if the user can see the selected property images by clicking on the "Show This Property Images".


property images


if the user want to see all properties list by clicking on the "Show All Properties" button .


owners properties list

7 - The Real Estate System , Property's Images Form


in this form the user can see all properties displayed in a datagridview, and all types on a listbox.


manage property images

if the user select a type from the listbox => all properties in this type will be displayed in the datagridview.




when you select a property from the datagridview => all this property's images id will be displayed in another listbox => and when you select an item from the list the image will show up in a pictureBox.






the user can browse a photo from his computer and add it to the selected property.
the user can remove the selected image by selecting it from the listbox.
there is no edit image, just add and remove.


manage property images 2

when you click on the "Show This Property Images" a form will show up with a SlideShow to display the images and two buttons to navigate.


property images slider

8 - The Real Estate System , Sales Form


in this form the user can manage the properties sales.
this form contains 3 tables:
1 - display the clients.
2 - display the properties.
3 - display the sales.
and you can add, edit remove the selected sale.


property sale form


properties sales form

to display only the properties sold the user need to click on the "Properties Sold". 


properties sold

to display only the properties NOT sold the user need to click on the "Properties Not Sold". 


properties not sold

to display ALL the properties the user need to click on the "All Properties". 

all properties



if you want the source code click on the download button below