Textbox validation for ' in vb.net

Textbox validation for ' in vb.net
========================================================================================
Private Sub TextBox2_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Txtaddress.KeyPress
Dim i As String = e.KeyChar.ToString()
If i = "'" Then
e.Handled = True
End If
End Sub
=======================================================================================

Session in php

Session in php
session_start();
$_SESSION['name']="Anuraj";
?>

functions in php

functions in php
=====================================================================================
function add()
{
$a=10;
$b=15;
$c=$a+$b;
echo $c;
}
add();
?>
-------------------------------------------------------------------------------------

function add($a,$b)
{
$c=$a+$b;
return $c;
}
$i=add(10,25);
echo $i;

?>
=====================================================================================

ARRAY IN PHP

ARRAY IN PHP
$a=array("violet","indigo","blue","green");
echo "The first element of the array is".reset($a)."
";
echo "The next element of the array is".next($a)."
";
echo "The first element of the array is".prev($a)."
";
echo "The first element of the array is".end($a)."
";
?>

$a= array("violet","indigo","blue","green");
print_r($a);
echo "
";
array_push($a,"yellow");
print_r($a);
echo "
";
array_pop($a);
print_r($a);
echo "
";
array_unshift($a,"red");
print_r($a);
echo "
";
array_shift($a);
print_r($a);
echo "
";

?>

HOW TO CREATE COOKIES IN PHP

HOW TO CREATE COOKIES IN PHP
=======================================================================================
setcookie('uname','Raju',4200);
$_COOKIE['uname']='Raju';
echo $_COOKIE['uname'];
?>
=======================================================================================

IF ELSE IN PHP

IF ELSE IN PHP
=======================================================================================
$a=10;
$b=15;
if($a>$b)
echo "Biggest number is".$a;
else
echo "Biggest number is".$b;
?>
=======================================================================================

HOW TO READ TXTFILE IN PHP


HOW TO READ TXTFILE IN PHP

=======================================================================================
$fp=fopen("temp.txt","r");
$data=fread($fp,10);
echo $data;
fclose($fp);
?>
=======================================================================================

HOW TO OPEN AND WRITE TXTFILE IN PHP

OPEN AND WRITE TXTFILE IN PHP
=======================================================================================
$fp=fopen("temp.txt","w");
fwrite($fp,"Hello, goodmorning");
fclose($fp);
?>
=======================================================================================

HOW TO ADD DATA FROM DATADASE TO GRID IN ASP.NET

FUNCTION FOR ADDING DATA FROM DATADASE TO GRID IN ASP.NET
-------------------------------------------------------------------------------------
public void grid()
{
DataTable dt = new DataTable();
string qu1 = "select * from shop_category";
dt = obj.call(qu1);
if (dt.Rows.Count > 0)
{
Gridcategory.DataSource = dt;
Gridcategory.DataBind();
}
else
{

}
}
-------------------------------------------------------------------------------------

Web projectes(ASP.NET,PHP)

1 Library Management System

2 Hospital Management System

3 Office automation System

4 E-post

5 Miles Acquisition System

6 Crime Detection

7 Online shopping cart

8 Online automobile showroom

9 Online mobile shop

10Forum project

11University Information System

12Auction Site (I think it is an online bidding site)

13Tele medicine

14Software Solution

15Project out Sourcing

16Police Information System

17Election System

18Job Portal Document Management System

19New Portal Online Art gallery

20Online Examination

21Online Banking Insurance Site

22Universal Experts

Windows project

1 Hospital Management System

2 Library Management System

3 Desktop monitoring

4 Project outsourcing

5 Rental System

6 PC based examination System

7 School management system

8 Biometric attendance

9 Ip chat

10Super Market billing

11Super market billing using bar code

12Office automation System

ASP.NET INTERVIEW QUESTIONS

1. When was ASP.NET released?
ASP.NET is a part of the .NET framework which was released as a software platform in
2002
2. Explain Namespace.
Namespaces are logical groupings of names used within a program. There may be multiple
namespaces in a single application code, grouped based on the identifiers’ use. The name of
any given identifier must appear only once in its namespace.
3. List the types of Authentication supported by ASP.NET.
o Windows (default)
o Forms
o Passport
o None (Security disabled)
4. What is CLR?
Common Language Runtime (CLR) is a run-time environment that manages the execution
of .NET code and provides services like memory management, debugging, security, etc. The
CLR is also known as Virtual Execution System (VES).
5. List the various stages of Page-Load lifecycle.
o Init()
o Load()
o PreRender()
o Unload()
6. Explain Web Services.
Web services are programmable business logic components that provide access to
functionality through the Internet. Standard protocols like HTTP can be used to access
them. Web services are based on the Simple Object Access Protocol (SOAP), which is an
application of XML. Web services are given the .asmx extension.
7. What is Postback?
When an action occurs (like button click), the page containing all the controls within the
tag performs an HTTP POST, while having itself as the target URL. This is
called Postback.
8. Explain the differences between server-side and client-side code?
Server side scripting means that all the script will be executed by the server and interpreted
as needed. Client side scripting means that the script will be executed immediately in the
browser such as form field validation, clock, email validation, etc. Client side scripting is
usually done in VBScript or JavaScript. Since the code is included in the HTML page, anyone
can see the code by viewing the page source. It also poses as a possible security hazard for
the client computer.
9. Describe the difference between inline and code behind.
Inline code is written along side the HTML in a page. There is no separate distinction
between design code and logic code. Code-behind is code written in a separate file and
referenced by the .aspx page.
10. List the ASP.NET validation controls?
o RequiredFieldValidator
o RangeValidator
o CompareValidator
o RegularExpressionValidator
o CustomValidator
o ValidationSummary
11. What is Data Binding?
Data binding is a way used to connect values from a collection of data (e.g. DataSet) to
the controls on a web form. The values from the dataset are automatically displayed in the
controls without having to write separate code to display them.
12. Describe Paging in ASP.NET.
The DataGrid control in ASP.NET enables easy paging of the data. The AllowPaging
property of the DataGrid can be set to True to perform paging. ASP.NET automatically
performs paging and provides the hyperlinks to the other pages in different styles, based on
the property that has been set for PagerStyle.Mode.
13.What is the difference between Server.Transfer and Response.Redirect?
o Response.Redirect: This tells the browser that the requested page can be
found at a new location. The browser then initiates another request to the new
page loading its contents in the browser. This results in two requests by the
browser.
o Server.Transfer: It transfers execution from the first page to the second page
on the server. As far as the browser client is concerned, it made one request and
the initial page is the one responding with content. The benefit of this approach is
one less round trip to the server from the client browser. Also, any posted form
14. What namespaces are imported by default in ASPX files?
The following namespaces are imported by default. Other namespaces must be imported
manually using @ Import directives.
o System
o System.Collections
o System.Collections.Specialized
o System.Configuration
o System.Text
o System.Text.RegularExpressions
o System.Web
o System.Web.Caching
o System.Web.Security
o System.Web.SessionState
o System.Web.UI
o System.Web.UI.HtmlControls
o System.Web.UI.WebControlsariables
15.What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the
page. ViewState is transported to the client and back to the server, and is not stored on the
server or any other external source. ViewState is used the retain the state of server-side
objects between postabacks.

Engineering projects

1. RFID Based Asset Management: - To track costly asset like laptops, PDA etc. If an asset is removed from company the reader will automatically marks its entry out and the person who is taking this out.

2. PDA Based Badminton Score Tracker

3. Personal Account Manageme
nt (Mobile/PDA):-
Application that can keep track of income and expenses of a person.

4. Online Pocket Dictionary(Mobile/PDA)

5. Implementation of Obex Layer over Bluetooth: - To build an Obex Layer upon the Bluetooth radio so that the device using this protocol can use Obex to send/receive binary/text files.
6. Offline Pocket Dictionary(Mobile/PDA)

7. Movie Ticket Reservation using SMS

8. Data Collection using Handhelds

9. Wireless Computing System for Police

10. Webcam Based Security System

11. SMS Time Table Alert

12. RFID Based Attendance Management

How to create text document in vb.net

To create text document
---------------------------------------------------------------------------------------
Private Sub Btcreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btcreate.Click
Try

IO.File.WriteAllText("C:/anuraj.txt", "ANURAJ S")
MessageBox.Show("text document created")

Catch ex As Exception

End Try

End Sub
---------------------------------------------------------------------------------------

WHAT'S NEW IN .NET FRAMEWORK 3.5 SP1?

SP1 advances the art of application development
The new ADO.NET Entity Framework feature in SP1 offers developers a model-based paradigm and a rich, standards-based framework for creating data-oriented applications shared across multiple applications and platforms. The separation of presentation, data, and business logic used in concert with a single data model will enable developers to spend less time writing plumbing code and more time refining business logic.

SP1 makes data-driven programming easier
SP1 offers developers support for ASP.NET Dynamic Data, which provides a rich scaffolding framework that enables rapid data-driven development. Since ASP.NET takes care of creating the presentation layer, a fully functional Website is output and ready for customization without the developer writing a single line of code. Further, with ADO.NET Data Services, Web developers can create RESTful Web 2.0-style applications that have better server scalability and improved caching support.

SP1 is the fastest and easiest way to deploy Windows applications
With the .NET Framework Client Profile, a small subset of the Framework that powers client applications, developers can offer their end users a dramatically streamlined and rapid application download experience. In addition, improvements in SP1 result in dramatic reductions in cold start times, allowing developers to serve a broader set of customers with varying hardware profiles.

How to declare datatype in vb.net

How to declare string?
dim str as string
How to declare DataTable?
Dim dt As New DataTable
How to declare Integer?
Dim i As New Integer
How to declare DDecimal?
Dim j As New Decimal
How to declare DataSet?
Dim ds As New DataSet
How to declare Boolean?
Dim flag As Boolean = True

HOW TO CLOSE A FORM IN VB.NET

CLOSE A FORM IN VB.NET
---------------------------------------------------------------------------------------
Private Sub Btclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
---------------------------------------------------------------------------------------

How to add datebase values to listview in vb.net

Function for adding datebase values to listviewin vb.net

------------------------------------------------------------------------------------

Public Sub list()
ListView1.Items.Clear()
Dim cal As String = "Select slno,code,name,rrate,wrate from stock"
Dim dt As New DataTable
dt = obj.call1(cal)
Dim i, j As Integer
j = dt.Rows.Count
If j > 0 Then
For i = 0 To j - 1
Dim asd As New ListViewItem(dt.Rows(i)("slno").ToString())
asd.SubItems.Add(dt.Rows(i)("Name").ToString())
asd.SubItems.Add(dt.Rows(i)("code").ToString())
asd.SubItems.Add(dt.Rows(i)("wrate").ToString())
asd.SubItems.Add(dt.Rows(i)("rrate").ToString())
ListView1.Items.Add(asd)
Next
End If
End Sub
-------------------------------------------------------------------------------------

HOW TO CREATE COMMON ID NUMBER IN VB.NET

FUNCTION FOR CREATE COMMON ID NUMBER
-------------------------------------------------------------------------------------
Public Sub idno() '
Dim dt As New DataTable
Dim cal As String = "select staff_id_no from tb_staff order by staff_id desc"
dt = obj.call1(cal)
If dt.Rows.Count > 0 Then
Dim idno As String = dt.Rows(0)("staff_id_no").ToString
Dim length As Integer = idno.LastIndexOf("/")
Dim length1 As Integer = length + 1
Dim totlength As Integer = idno.Length
Dim totlength1 As Integer = totlength - length1
idno = idno.Substring(length1, totlength1)
Dim idno1 As Decimal = Convert.ToDecimal(idno)
Dim idno2 As Decimal = idno1 + 1
Lblidno.Text = "ANU/09/" + idno2.ToString
Else
Lblidno.Text = "ANU/09/1001"
End If
End Sub
-------------------------------------------------------------------------------------

HOW TO INITIALIZE DATAGRIDVIEW IN VB.NET

FUNCTION FOR INITIALIZE DATAGRIDVIEW
-------------------------------------------------------------------------------------
Public Sub INITIALIZE_GRID_VIEW()
Dim dt As New DataTable
Dim Name As DataColumn = New DataColumn("Slno")
Dim Name1 As DataColumn = New DataColumn("Field1")
Dim Name2 As DataColumn = New DataColumn("Field2")
Dim Name3 As DataColumn = New DataColumn("Field3")
Dim Name4 As DataColumn = New DataColumn("Field14")
Dim Name5 As DataColumn = New DataColumn("Field5")
'Name5.ReadOnly = True
dt.Columns.Add(Name)
dt.Columns.Add(Name1)
dt.Columns.Add(Name2)
dt.Columns.Add(Name3)
dt.Columns.Add(Name4)
dt.Columns.Add(Name5)
DataGridView1.DataSource = dt
End Sub
-------------------------------------------------------------------------------------

How to add database values to comboboxes in vb.net

Function for add database values to combobox
=====================================================================================
Public Sub drop_comboboxe ()
ComboBoxvehicle.Items.Clear()
Dim dt As New DataTable
dt = obj.call1("Select tablefieldname from table")
Dim i As Integer = dt.Rows.Count
Dim j As Integer = 0
If i > 0 Then
For j = 0 To i - 1
ComboBoxvehicle.Items.Add(dt.Rows(j)("tablefieldname").ToString
Next
End If
End Sub
=====================================================================================

Custom Format of Datetimepicker in vb.net



different custom formats
date/month/year(dd/MM/yyyy) 22/02/2009

month/date/year(MM/dd/yyyy) 08/13/2009)

month/date/year(MM/dd/yy)08/13/09

date/month/year (dd/MM/yyyy) 02-Aug-2009

How to take values from datetimepicker

Values from datetimepicker
--------------------------------------------------------------------------------------
DateTimePicker1.Text=------------sunday, August 02, 2009
DateTimePicker1.Value.Date=------ 8/2/2009
DateTimePicker1.Value.Day=------- 2
DateTimePicker1.Value.Month=----- 8
DateTimePicker1.Value.Year=------ 2009
DateTimePicker1.Value.ToString=-- 8/2/2009 11:58:08 AM
---------------------------------------------------------------------------------------

How to take values from listview in vb.net

To take values from listview in vb.net
-------------------------------------------------------------------------------------
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Try
Lblidno.Text = ListView1.Items(ListView1.SelectedItems(0).Index).SubItems(0).Text
Txtname.Text = ListView1.Items(ListView1.SelectedItems(0).Index).SubItems(1).Text
Catch ex As Exception
End Try
End Sub
---------------------------------------------------------------------------------------

HOW TO CONVERT DATATABLE TO LISTVIEW IN VB.NET

FUNCTION FOR CONVERTING DATATABLE TO LISTVIEW
-------------------------------------------------------------------------------------
Public Sub CONVERT_DATATABLE_TO_LISTVIEW(ByVal DATA_TABLE As DataTable, ByRef LS_VIEW As ListView, ByVal HEAD_ARR() As String)
' Dim LS_VIEW As New ListView
LS_VIEW.View = View.Details
LS_VIEW.GridLines = True
LS_VIEW.FullRowSelect = True
Dim COL_INDEX As Integer = 0
For Each DCOL As DataColumn In DATA_TABLE.Columns
Dim ADD_FLG As Boolean = False
Try
LS_VIEW.Columns.Add(HEAD_ARR(COL_INDEX).ToUpper, (HEAD_ARR(COL_INDEX).Length * 7) + 20)
Catch ex As Exception
'MessageBox.Show(ex.Message)
ADD_FLG = True
End Try
If ADD_FLG Then
LS_VIEW.Columns.Add(DCOL.Caption.ToUpper, (DCOL.Caption.Length * 7) + 20)
End If
COL_INDEX += 1
Next
For Each DROW As DataRow In DATA_TABLE.Rows
Dim LS_ITEM As New ListViewItem(DROW.Item(0).ToString)
COL_INDEX = 0
For Each DCOL As DataColumn In DATA_TABLE.Columns
If COL_INDEX <> 0 Then
LS_ITEM.SubItems.Add(DROW.Item(COL_INDEX).ToString)
End If
COL_INDEX += 1
Next
LS_VIEW.Items.Add(LS_ITEM)
Next
End Sub
-------------------------------------------------------------------------------------

HOW TO CONVERT OF LISTVIEW TO DATATABLE IN VB.NET

Function CONVERSION OF LISTVIEW TO DATATABLE
-------------------------------------------------------------------------------------
Public for Function CONVRSION_LISTVIEW_TO_DATATABLE(ByVal LS_VIEW As ListView) As DataTable
'LS_VIEW.Items.Clear()
Dim DT_TAB As New DataTable
If LS_VIEW.Items.Count < 1 Then
Return DT_TAB
Else
For i As Integer = 0 To LS_VIEW.Items(0).SubItems.Count - 1
Dim DCOL As New DataColumn(LS_VIEW.Columns(i).Text)
DT_TAB.Columns.Add(DCOL)
Next
End If
For i As Integer = 0 To LS_VIEW.Items.Count - 1
Dim DROW As DataRow = DT_TAB.NewRow
For j As Integer = 0 To LS_VIEW.Items(i).SubItems.Count - 1
DROW(LS_VIEW.Columns(j).Text) = LS_VIEW.Items(i).SubItems(j).Text
Next
DT_TAB.Rows.Add(DROW)
Next
Return DT_TAB
End Function
-------------------------------------------------------------------------------------

HOW TO CONVERT DATAGRID TO DATATABLE


Function for CONVERSION OF DATAGRID TO DATATABLE

---------------------------------------------------------------------------------------
Public Function CONVRSION_DATAGRID_TO_DATATABLE(ByVal GRID_VIEW As DataGridView) As DataTable
Dim DT As New DataTable
DT = TryCast(GRID_VIEW.DataSource, DataTable)
Return DT
End Function
---------------------------------------------------------------------------------------

How to take auto number(IDENTITY no ) in vb.net

command.ExecuteNonQuery()
command.CommandText = "Select @@IDENTITY"
ID = command.ExecuteScalar

insert this code after ExecuteNonQuery and Return ID

To take the coloumn sum from a DataGridView in vb.net

To take the sum from a DataGridView in vb.net

-------------------------------------------------------------------------------------
Public Sub UPDATE_TOTAL_PRICE()
PRICE_LABEL.Text = FIND_TOT_PRICE()
End Sub
-------------------------------------------------------------------------------------
Public Function FIND_TOT_PRICE() As Double
Dim TOTAL_SUM As Double = 0
Try
For Each dtRow As DataGridViewRow In DataGridView1.Rows
TOTAL_SUM += CType(dtRow.Cells(4).Value, Double)
Next
Catch ex As Exception
'MessageBox.Show(ex.Message)
Return TOTAL_SUM
End Try
Return TOTAL_SUM
End Function
-------------------------------------------------------------------------------------

To take the coloumn sum from a listview in vb.net

To take the sum from a listview in vb.net
-------------------------------------------------------------------------------------
Private Sub Btsum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btsearch.Click
Lblamount.Text = FIND_TOT_AMT
End Sub
-------------------------------------------------------------------------------------
Public Function FIND_TOT_AMT() As Double
Dim k As Integer = 0
Try
Dim j As Integer = ListView1.Items.Count
Dim i As Integer
For i = 0 To j - 1
k += CType(ListView1.Items(i).SubItems(2).Text, Integer)
Next
Catch ex As Exception
End Try
Return k
End Function
-------------------------------------------------------------------------------------

Important queryes for sql database

How to create database?
create database databasename
How to create table?
Create table tablename(tablefieldname varchar(50),tablefieldname1 varchar(50),tablefieldname2 varchar(50))
How to alter table?
alter table tablename add tablefieldname3 int
How to read from table?
select * from tablename
How to insert data to table?
insert into tablename values ('ANURAJ S','Chathannoor','9447990404')
How to update data from table?
update tablename set tablefieldname3=5 where ptablefieldname='ANURAJ S'
How to delete data from table?
delete from tablenamewhere ptablefieldname='ANURAJ S'
how to join 2 tables?
select * from tablename a INNER JOIN tablename1 b on a.tablefieldname=b.tablefieldname2
in this tablefieldname and tablefieldname2 contain common values and they are in same format

Insert data to access database in vb.net

Insert / Delete / Update data to access database

-------------------------------------------------------------------------------------
'connection string
Public con_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/db_databasename.mdb"
-------------------------------------------------------------------------------------
Private Sub Btinsert_Click(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles Btsearch.Click
Try
EXECUTE_NON_QUERY("insert into tablename (tablefieldname) values ('"& txtbox1.text&"'")
Catch ex As Exception
End Try
End Sub
-------------------------------------------------------------------------------------

Public Function EXECUTE_NON_QUERY(ByVal QUERY As String) As Boolean
Dim connection As New OleDbConnection(con_str)
Try
connection.open()
Dim command As New OleDbCommand(QUERY, connection)
command.ExecuteNonQuery()
Catch ex As Exception
MessageBox.show(ex.message)
Return False
Finally
connection.Close()
End Try
Return True
End Function

read data from access database in vb.net

read data from access database
'connection string
-------------------------------------------------------------------------------------
Public con_str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/db_atabasename.mdb"
-------------------------------------------------------------------------------------
Private Sub Btsearch_Click(ByVal sender As System.Object, ByVal e As system.EventArgs) Handles Btsearch.Click
Try
Dim ds As New DataSet
ds=EXECUTE_READ_QUERY("Select * from tablename")
Catch ex As Exception
End Try
End Sub
-------------------------------------------------------------------------------------
'function for read the data
Public Function EXECUTE_READ_QUERY(ByVal QUERY As String) As DataSet
Dim ds As New DataSet
Dim connection As New OleDbConnection(con_str)
Try
connection.open()
Dim adapter As New OleDbDataAdapter(QUERY, connection)
adapter.fill(ds)
Return ds
Catch ex As Exception
MessageBox.show(ex.message)
Return ds
Finally
connection.Close()
End Try
Return ds
End Function
-------------------------------------------------------------------------------------

REMOVE TIME FROM DATE IN SQL

The following conversion options are available for sql datetime format with century:

select convert(char, getdate(), 100) -- mon dd yyyy hh:mmAM (or PM) FROM TABLENAME

select convert(char, getdate(), 101) -- mm/dd/yyyy

select convert(char, getdate(), 102) -- yyyy.mm.dd

select convert(char, getdate(), 103) -- dd/mm/yyyy

select convert(char, getdate(), 104) -- dd.mm.yyyy

select convert(char, getdate(), 105) -- dd-mm-yyyy

select convert(char, getdate(), 106) -- dd mon yyyy

select convert(char, getdate(), 107) -- mon dd, yyyy

select convert(char, getdate(), 108) -- hh:mm:ss

select convert(char, getdate(), 109) -- mon dd yyyy hh:mm:ss:mmmAM (or PM)

select convert(char, getdate(), 110) -- mm-dd-yyyy

select convert(char, getdate(), 111) -- yyyy/mm/dd

select convert(char, getdate(), 112) -- yyyymmdd

select convert(char, getdate(), 113) -- dd mon yyyy hh:mm:ss:mmm

select convert(char, getdate(), 114) -- hh:mm:ss:mmm(24h)

select convert(char, getdate(), 120) -- yyyy-mm-dd hh:mm:ss(24h)

select convert(char, getdate(), 121) -- yyyy-mm-dd hh:mm:ss.mmm

select convert(char, getdate(), 126) -- yyyy-mm-ddThh:mm:ss.mmm

REMOVE TIME FROM DATE IN ACCESS DATABASE

Getting Only the Date Part of a Date/Time Stamp in ACCESS

"select datefield from tablename"

06/15/2007 12:00:00 PM

"Select FORMAT(datefield, 'd /MM/ yyyy') as datefield from tablename"

15/06/2007

"Select FORMAT(datefield, 'MM /d / yyyy') as datefield from tablename"

06/15/2007

DECIMAL NUMBER VALIDATION IN VB.NET

How to give DECIMAL validate in textbox(10.00,10.52......)
take keypress event of textbox



Private Sub Txtspr_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Txtspr.KeyPress
Dim HND_FLG As Boolean = False
Dim POINT_FOUND As Boolean = False
Dim y As String = Txtspr.Text
Dim i As String = e.KeyChar.ToString
If i = "" Then
Else
If i = "." Then
For Each asd As Char In y
If asd = "." Then
HND_FLG = True
End If
Next
If HND_FLG Then
e.Handled = True
End If
Else
If IsNumeric(i) Then
Else
e.Handled = True
MessageBox.Show("Enter valid Number")
End If
End If
End If
End Sub

NUMBER VALIDATION IN VB.NET

How to give number validate in textbox
take keypress event of textbox

Private Sub Txtqty_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Txtqty.KeyPress
Dim i As String = e.KeyChar.ToString
If i = "" Then
Else
If IsNumeric(i) Then
Else
e.Handled = True
MessageBox.Show("Enter valid Number")
End If
End If
End Sub