Jx_Man 987 Nearly a Senior Poster Featured Poster

make a function or procedure to do autonumber. every you finish add,edit,delete or clear form call that procedure or function
the easiest logic of autonumber is select the last value of RecordID and add it by 1.

Jade_me commented: Excelent +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

http://www.garybeene.com/vb/tut-api.htm
http://www.developer.com/net/vb/article.php/1537091
yes, you can add flash file (.swf) on vb and play it.
if u have a problem with api, post the thread and all of people here will help u much..
Ok. all for the best

dnk commented: usefull +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

check this prog if i didn't wrong to understand your question :

GetMouseButton States.zip

OK. Hope this helps..

Sawamura commented: add my knowledge +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code, i used InStr() function to search the .xls string in file title of file.

Private Sub btnOpen_Click()
With CommonDialog1
            .Filter = "All Files|*.*|Excel|*.xls"
            .FilterIndex = 4
End With
CommonDialog1.ShowOpen
txtPath.Text = CommonDialog1.FileName
If (InStr(1, CommonDialog1.FileTitle, ".xls", vbBinaryCompare) = 0) Then
    MsgBox "This is not Excel File"
Else
    MsgBox "This is an Excel File"
End If
End Sub

OK. Hope this helps..

Jade_me commented: wow, i never tried this before +1
Estella commented: nice post +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

this is my code when read data from multiple tables, in my code just for two tables, you can change to three or more tables.

Private Sub Show_Datagrid()
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable

        conn = GetConnect()
        Try
            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT a.Id_User as 'User Id', a.Password , b.Id_Role as 'Role Id', b.Status FROM USERS a join ROLE b on (a.Id_Role=b.Id_Role)"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dgUser.DataSource = dsUser
            dgUser.DataMember = "User"
            dgUser.ReadOnly = True
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error Connection!!")
        End Try
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi masters...,
anyone know this method ("Genetic K-means Algorithm / GKA") ?.
this method used for clustering data.
so, i need some article or tutorial about this or similar with this method...
i have been looking for this article from internet but i didn't get the good one. maybe i can get some article from you all.
please helps...

Jery.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hehe....
i got the right one...

Jx_Man 987 Nearly a Senior Poster Featured Poster

use temp textbox and you just call the value of textbox from other form

Private Sub DBGrid1_Click()
With DBGrid1
    .Col = 0 ' start from coloumn 1 
    txtIndex.Text = .Text
End With
Set db = OpenDatabase(App.Path + "\YourDatabaseName.mdb")
Set rs = db.OpenRecordset("YourTableName")
If (rs.RecordCount >= 1) Then
Do While Not rs.EOF
   If rs.Fields("Index") = txtIndex.Text Then
      txtIndex.Text = rs.Fields("Index")
      txtName.Text = rs.Fields("Name")
     
    Exit Do
    End If
    rs.MoveNext
Loop
End If

to show in other form use this :

txtNewIndex.text = Form1.txtIndex.text
txtNewName.text = Form1.txtName.text
Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Toolbar1.Buttons.Item(Button.Index).Index
    Case 1
         MsgBox "save"
    Case 2
         Form2.Show
            
End Select
End Sub

case 1 = its button index, start with 1

Vega_Knight commented: :D +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

i have this problem before but i never tried to use another installer before, i just use the deployment package that it included in vs.net.
i did like this :
1. Open your project
2. Click File - New - Project - Setup and Deployment Projects
you will see the file setup window and include 3 folders application Folder,user's desktop,user program menu.
3. Select Setup Project
4. Right Click on Application Folder - Add - Project Output
5. select Primary Output
6. then right click on project setup name in solution explorer.
7. click Add - then select Merge Module
8. choose 4 File to add :
Crystal_Database_Access2003.msm
Crystal_Database_Access2003_enu.msm
Crystal_Managed2003.msm
Crystal_regwiz2003.msm
after you add that files, select on Crystal_regwiz2003.msm file. see the properties (upper of properties) and expand the MergeModuleProperties and fill the key license with serial number for crystal report (you can see the keynumber on Help-about microsoft development environment)
9. do the Build..
10. finish...

Jade_me commented: thx, its very helping +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

this is a value of style :

AppWinStyle.Hide
AppWinStyle.NormalFocus
AppWinStyle.MinimizedFocus
AppWinStyle.MaximizedFocus
AppWinStyle.NormalNoFocus
AppWinStyle.MinimizedNoFocus

this sample code :

Shell("NOTEPAD.EXE", AppWinStyle.MinimizedNoFocus)

notepad didn't have to use full path cause location of notepad is in the windows folder

Shell("C:\Documents and Settings\Jerry\My Documents\AntiVrs.exe", AppWinStyle.MinimizedNoFocus)
Sawamura commented: Excelent +1
dnk commented: nice +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

this following code to save int file into DAT file :

# include <iostream.h>
# include <fstream.h>

void main ()
{
	int data[] = { 23, 456, 678, 2314, 20, 56, 30981};
	cout<< "Record Data...." <<endl;
	ofstream file_data("INT.DAT", ios::binary);
	for (int i = 0;i < (sizeof(data)/sizeof(int)); i++)
		file_data.write((char *) &data[i], sizeof(int));
	file_data.close();
}
dnk commented: Perfect +1
Sawamura commented: Thanks +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean the form can be change like opacity.If i right then try this following code :
add this following code to module :

Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long,ByVal dwNewLong As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long,ByVal nCmdShow As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long,ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private Const GWL_EXSTYLE As Long = -20
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2

Public Function Transparant(hwnd As Long, percent As Integer,pil As Boolean)
	Dim before as Long
	before = GetWindowLong(hwnd,GWL_EXSTYLE)
	If pil = true then
		before = before Or WS_EX_LAYERED
		SetWindowLong hwnd, GWL_EXSTYLE, before
		SetLayeredWindowAttributes hwnd, 0, 255 * (percent / 100), LWA_ALPHA
	Else
		before = before And Not WS_EX_LAYERED
		SetWindowLong hwnd, GWL_EXSTYLE, before
	End If
End Function

you can call the function like this :

Transparant Form1.hwnd, val(txtPercent.text), true

you can change text box with other control to get value as percent

Ok. Hope it helps..

Jade_me commented: really complex +1
ITKnight commented: confusing but this a nice code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

shell function used to apply/run other application and sava the task ID of that application as feedback value. so if none application or failed to call then the feedback value is 0.

this following code is used sintax :
shell(path_Name[,style][,wait][,timeout])
path_name = executable file with the full path of the application which it want to call
Style = a model of application window which it want to call (ex minimize,normal etc).
Wait = a boolean value that prescriptive whether shell function has to wait vb.net finish before working. false is the default value.
TimeOut = a wait time that it needful by shell function to start working if Wait in true value.

Ok.this a little explain. hope it helps..

Jade_me commented: Really Helps to me +1
dnk commented: great explaination +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code and change the code as you needed :

CrystalReportViewer1.selectionFormula = "Date({DbName.TableName})>= #" & DateTimePicker1.value & " # And Date({DbName.TableName})<= #" & DateTimePicker2.value & "#" 
CrystalReportViewer1.RefreshReport()
Sawamura commented: thx +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

I Can Do Everything Through HIM Who Gives Me Strength

Jx_Man 987 Nearly a Senior Poster Featured Poster

if i not wrong, it's the old name for what are now Xbase files.so basically anything that will open Xbase should open xdb.
It is also the extension given to Norton Anti Virus updates

Jx_Man 987 Nearly a Senior Poster Featured Poster

set the background image,FlatStyle,ImageAlign and size on your button properties it will like this..

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmmm...
this never ending. everyone/nation think they right. to many thoughts and all be in contradiction.
actually peace start from ourself. so we can't compulse other people to change but we must change.

Jx_Man 987 Nearly a Senior Poster Featured Poster

not a public variable but public shared variable.
this ex of the code (this code running clearly in vb.net 2003, you can try in vb.net 2008 ):

eg your first form named Login

Public Shared Name As String
....
    Name = txtUserId.text

and this for the call in other forms :

...
lblNameUser.Text = "Welcome " & Login.Name

you can modified this code to accomodate check box state.

OK.Hope this helps..

dnk commented: i did not know about this variable before +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi dani...
may i know how can to add my Reputation-Altering Power?i got a little confused here..

thx. best regards..

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi all,
i was implemented the code correctly but i got this following error :
The type or namespace name 'DataGridViewEventHandler' could not be found (are you missing a using directive or an assembly reference?)

i use vb.net 2003 and sqlserver 2000

i stuck on here, i was written a code but when i click datagrid nothings happened..
this my code that i was tried before :

private void dgUser_Click(object sender, System.EventArgs e)
{
	int i;
	SqlConnection cnn;
	SqlCommand cmdUser = new SqlCommand();
	SqlDataAdapter daUser = new SqlDataAdapter();
	DataSet dsUser = new DataSet();
	DataTable dtUser = new DataTable();
			
	i = dgUser.CurrentRowIndex;
	cnn = (System.Data.SqlClient.SqlConnection) Koneksi.GetConnect();
	try
	{
		cmdUser = cnn.CreateCommand();
		cmdUser.CommandText = "SELECT * FROM Users where Id_User ='" + dgUser.GetCellBounds(i,0)   + "'";
		daUser.SelectCommand = cmdUser;
		daUser.Fill(dsUser, "Users");
		dtUser = dsUser.Tables["Users"];
				
		if (dtUser.Rows.Count > 0)
		{
			
			txtUserId.Text = System.Convert.ToString(dtUser.Rows[0][0]);
			txtPasw.Text = System.Convert.ToString(dtUser.Rows[0][2]);
			switch (System.Convert.ToString(dtUser.Rows[0][1]))
			{
				case "1":
						
				cmbStatus.SelectedIndex = 0;
				break;
				case "2":
							
				cmbStatus.SelectedIndex = 1;
				break;
				case "3":
							
				cmbStatus.SelectedIndex = 2;
				break;
			}
		}
				
	}
		catch (Exception ex)
	{
		Interaction.MsgBox("Error: " + ex.Source + ": " + ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!");
	}
}

Please help me.....
best regards..

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi all...
I m working for my graduated project. and my method in using is Genetic K-means Algorithm. i m using vb.net 2003 and sql server 2000. Does Anyone know a sample code for this?or a website / link for this topic???

please help me...
any reply really appreciated...
Thx.Best regards...

Jx_Man 987 Nearly a Senior Poster Featured Poster

what db that u using?
if u use sql server 2000, try this following code :
this code will fill the combobox ..

Private Sub BacaData()
        Dim i As Integer
        Dim cmdTraining As New SqlCommand
        Dim daTraining As New SqlDataAdapter
        Dim dsTraining As New DataSet
        Dim dtTraining As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdTraining = conn.CreateCommand
            cmdTraining.CommandText = "SELECT * FROM Training"
            daTraining.SelectCommand = cmdTraining
            daTraining.Fill(dsTraining, "Training")
            dtTraining = dsTraining.Tables("Training")
            For i = 0 To dtTraining.Rows.Count - 1
                cmbId_Training.Items.Add(dtTraining.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error Connection!!")
        End Try
        conn.Close()
    End Sub

if u using list box u can change "cmbId_Training.Items.Add(dtTraining.Rows(i).Item(0))" with this one "ListBox1.Items.Add(dtTraining.Rows(i).Item(0))".

hope this helps...

brightmohan commented: Excellent. +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi Kartikey...
first : i wanna say welcome in dani web...
second : you didn't show any effort from your program..
"We only give homework help to those who show effort" :)
so, when you post thread again please show the effort...effort can make all of people here to understand the problem. thx :P...

if u want to insert or update you must to connect vb.net with sql server 2000.
for better (my opinion) u can use module so u can call every time in all form..
this code for connection module :

Imports System.Data
Imports System.Data.SqlClient  ' this is very important code that u must added 

Module Connect
    Public conn As SqlConnection
    Public Function GetConnect()
        conn = New SqlConnection("Server = YourServerName;" & "initial Catalog = YourDatabaseName;" & " Trusted_Connection=yes")
        Return conn
    End Function
End Module

this following code to insert data in database :

Dim check As Integer
    Dim conn As SqlConnection
    Dim cmdMedical As New SqlCommand
    Dim cmdMedical1 As New SqlCommand
    Dim daMedical As New SqlDataAdapter
    Dim dsMedical As New DataSet
    Dim dtMedical As New DataTable

                Try
                    conn = GetConnect() ' this when u call the module to connected....
                    conn.Open()
                    cmdMedical = conn.CreateCommand
                    cmdMedical.CommandText = "SELECT * FROM Medical WHERE Medical_No='" & Trim(txtMedical_No.SelectedItem) & " ' "
                    daMedical.SelectCommand = cmdMedical
                    daMedical.Fill(dsMedical, "Medical")
                    dtMedical = dsMedical.Tables("Medical")

                    If (dtMedical.Rows.Count > 0) Then
                        MsgBox("Patient With Medical_No " & Trim(txtMedical_No.Text) & " has been added in data base", MsgBoxStyle.OKOnly, "Message :") …
Jade_me commented: nice greetings..:P +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi arasten...
sorry for my post before...its code for vb.net but for vb its not different
this is the code :

Shell "shutdown -r -t 00"   ' for restart
Shell "shutdown -s -t 00"  ' for Shutdown
Shell "shutdown -l -t 00"   ' for log off
Shell "shutdown -a -t 00"  ' for abort

but its only work in xp os..
ok. all for the best

Naruse commented: Great Code +1
Jade_me commented: works... +1
ITKnight commented: nice code +1
dnk commented: Good +1
Vega_Knight commented: Worked :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

This code Using 'Shell':

Call Shell("Shutdown /s") 'to shutdown

Call Shell("Shutdwon /r") 'to restart

Call Shell("Shutdown /l") 'to logoff

Call Shell("Shutdown /a") 'to Abort

This Code Using 'Managed Code in .NET':

System.Diagnostics.Process.Start (Shutdown", "/s") 'to shutdown

System.Diagnostics.Process.Start("Shutdown", "/r") 'to restart

System.Diagnostics.Process.Start("Shutdown", "/l") 'to logoff

System.Diagnostics.Process.Start("Shutdown", "/a") 'to abort

Choose the one as u like..
The code in my post its a standard command...
You can add the function with more argument like described below:
to shutdown remote machine, add the argument ' /m MyRemoteMachineName' or
to make process delay, add the argument ' /t nn' with 'nn' is number of second eg: Call Shell("Shutdown /s /m upstaircomputer /t 30") 'it will shutdown the upstair computer in 30 second
if you want to know another argument, type shutdown /? in command prompt window

by - risky k (owner)

Vega_Knight commented: Wonderful:) +1
Naruse commented: Great Code :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

just vote..not comment

joshSCH commented: This is a forum.. people comment on everything, duhhhhh -2
Jx_Man 987 Nearly a Senior Poster Featured Poster

yup, you cannot get the source code from msi except you add your source code too when you build setup program.

Dukane commented: thank you +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi jade_me..
sawamura already give the function u just add one function again to release capture.
try this following code :

Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "user32" ()

Const WM_NCLBUTTONDOWN = &HA1 'when left mouse button is clicked
Const HTCAPTION = 2 'signed that mouse is working on titlebar.

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture 'tell system through mouse didn't working anymore.
        'tell system through mouse already working on form.
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then 'if left mouse button working.
        If Picture2.BorderStyle = 1 Then
            Picture2.BorderStyle = 0
        Else
            Picture2.BorderStyle = 1
        End If
    End If
End Sub

oh yeah, picture1 is titlebar and picture2 is like exit sign.

ok. this all from me, you can change code as u needed.
all for the best

Naruse commented: Helps me much +1
november_pooh commented: viesta +1
Vega_Knight commented: works like charm +1
Estella commented: worked... +1
ITKnight commented: thx +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi sawamura,
i reply many code using api function this day.

if u want to snaphot u can use api function (PrintWindow and WindowFromPoint)
this a little sample to you. u can develop as u want..

Private Declare Function PrintWindow Lib "user32" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
        x As Long
        y As Long
End Type

Dim lWFP As Long
Dim pt As POINTAPI

Private Sub Command1_Click()
    PrintWindow lWFP, Me.hDC, 0
End Sub

Private Sub Picture1_Click()
    Me.Picture1.AutoSize = True
End Sub

Private Sub Timer1_Timer()
    GetCursorPos pt
    lWFP = WindowFromPoint(pt.x, pt.y)
    Me.Caption = "Handle Window : " & Hex(lWFP)
End Sub

hope this code helps

Jx_Man 987 Nearly a Senior Poster Featured Poster

this api function :

private Declare function flashWindow Lib "user32" (ByVal hwnd as Long, ByVal bInvert as Long) As Long

add this code to timer1 :
FlashWindow Me.hwnd, 1

in this case i set timer interval = 500

hope this helps.
all for the best.

EkoX commented: Great to know this. but i don't know much about api function. +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

to play flash file u can use shockwave flash from com component.
To get this component you can see link from manal post.:)

this following code modified to open flash file :

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
        With OpenFileDialog1
            '.InitialDirectory = "C:\"
            .Filter = "swf File|*.swf"
            .FilterIndex = 2
        End With

        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            AxShockwaveFlash1.Stop()
            AxShockwaveFlash1.Movie = OpenFileDialog1.FileName
            AxShockwaveFlash1.Play()
            lblFilePath.Text = OpenFileDialog1.FileName()
        End If
    End Sub

OK.
all For the best.

Jade_me commented: help me too +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

actually i used module to connect with access database :

Module ModUmum

    Public Function Koneksi() As OleDb.OleDbConnection
        Dim con As OleDb.OleDbConnection
        con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath.ToString & "\yourdatabasename.mdb")
        Return con
        con = Nothing
    End Function

    Public bool As Boolean
    Public da As OleDb.OleDbDataAdapter
    Public dt As New DataTable
    Public i As Int16
    Public cmd As OleDb.OleDbCommand
    Public da1 As OleDb.OleDbDataAdapter
    Public strSQL As String
    Public CB As OleDb.OleDbCommandBuilder
    Public con = ModUmum.Koneksi

End Module

and i write my code like this

Try

        Dim connString As String
        Dim cmd As OleDb.OleDbCommand
        Dim KOneksi = ModUmum.Koneksi

       connString = "INSERT INTO Reservations (Transaction_Id, Item_Id, User_Id,Current_Date, Reserved_Until, Contact_Name, Contact_Tel)VALUES (trim(txtTransactionId.text), trim(txtItemId.text),trim(userid.text),dtpicker1.value.ToShortDateString, dtpicker2.value.ToShortDateString, trim(txtContactName.text),trim(txtContactTelp.text))"
               
                cmd = New OleDb.OleDbCommand(strSQL)
                cmd.Connection = con
                con.Open()
                cmd.ExecuteNonQuery()
                con.Close()

                 
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

ok. hope this help

Jx_Man 987 Nearly a Senior Poster Featured Poster

i will use shockwave flash.
find this control in component and check this.
it will showing in your toolbox, use like other and add this following code :
i use button here :

private sub command1_Click()
     shockwaveflash1.movie = yourFlashAppPath & "\yourFlashAppName
end sub

Ok.
all for the best

Elladan commented: hmmm ? +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i used this to load from sqlserver 2000

Private Sub ReadData()
        Dim i As Integer
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT * FROM User"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dtUser = dsUser.Tables("User")
            For i = 0 To dtUser.Rows.Count - 1
                cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error conection!!")
        End Try
        conn.Close()
    End Sub

call this procedure when form load (form load event)

for note :
cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

ok.
hope this help

Sawamura commented: thanks +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you can use err object. this object was built in vb.net.
i will give a simple code for u
try this following code :

sub main()
10:       on error goto errHandling
20:       dim a as integer = 2
30:       dim b as integer = 7
40:       dim c as integer
50:       z = x / y
60:       console.writeline("Value of c : " & c)
70:       exit sub
errHandling:
                 dim ErrMsg as string
                 ErrMsg = "Error Number = " & err.number
                 ErrMsg = chr(13)
                 ErrMsg = "Error Description = " & err.Description
                 ErrMsg = chr(13)
                 ErrMsg = "Erorr Line = " & err.erl
                 msgbox(ErrMsg)
                 resume next
end sub

you can use err.clear to clear every err object property
err.source to show object name or application which error provides.

Ok.
all for the best

Naruse commented: not understand :( +1
Sawamura commented: Thx buddy +1
Jade_me commented: Perfectly +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :
first you must made module to connect access to vb.net
add this following code in your module connected :

Module MyModule
    Public Function Conection() As OleDb.OleDbConnection
        Dim con As OleDb.OleDbConnection
        con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath.ToString & "\yourDatabaseName.mdb")
        Return con
        con = Nothing
    End Function
 End Module

after that you can call this module in your form code to connect with access db
ex :
Dim Connected = MyModule.Koneksi

then u can open connection (Connected .Open()) or close connection (Connected.close())

OK.
Hope this code helpfull

ITKnight commented: yes +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

if you use integer as id datatype (ex:1.2.3...n)
you can select max from id and add it by 1.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i think Arshad already give the solution

CrystalReportViewer.SelectionFormula() = "{Student.id_student}='" & Trim(txtIdStudent.text) & "' "

Student is the table Name & id_student is parameter

dnk commented: thx :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you must to have a main menu. u can add code in form login to disable sub menu agree with user role.
so when user finished login, user only chosen the sub menu or menu that user depending on.
ex :
Dim Menu As New Main_Menu
Menu.Show()
Menu.x.Enabled = False

x : menu or sub menu in main menu that u want to disable.

this my part project n have same like u. but i didn't use oledbdataadapter, just for comparison.

If cmbRole.SelectedIndex = 0 Then
                        If dtUser1.Rows(0).Item(0) = Trim(txtUserId.Text) Then 'checking user id
                            If dtUser2.Rows(0).Item(0) = Trim(txtPasw.Text) Then ' cheking password
                                If dtUser.Rows(0).Item("ID_ROLE") = 1 Then ' cheking role
                                    Dim menu As New Menu_Utama
                                    Menu.Show()
                                    Me.Dispose(False)
                                Else
                                    MsgBox("You not Admin")
                                End If
                            Else
                                MsgBox("Wrong password!!", MsgBoxStyle.Critical, "Password Error")
                            End If
                        Else
                            MsgBox("Your User Id is not valid", MsgBoxStyle.Critical, "Wrong User_Id")
                        End If
                    Else
                        If cmbRole.SelectedIndex = 1 Then
                            If dtUser1.Rows(0).Item(0) = Trim(txtUserId.Text) Then 'checking user id
                                If dtUser2.Rows(0).Item(0) = Trim(txtPasw.Text) Then ' cheking password
                                    If dtUser.Rows(0).Item("ID_ROLE") = 2 Then ' cheking role
                                        Dim menu As New Menu_Utama
                                        Menu.Show()
                                        Menu.mnUser.Enabled = False
                                        Menu.BarMenu.Buttons(6).Enabled = False
                                        Me.Dispose(False)
                                    Else
                                        MsgBox("You not Headmaster")
                                    End If
                                Else
                                    MsgBox("Wrong Password!!", MsgBoxStyle.Critical, "Password Error")
                                End If
                            Else
                                MsgBox("Your User Id is not valid", MsgBoxStyle.Critical, "Wrong User_Id")
                            End If
                        End If
                    End If

in my project, i have 2 user (Admin & Headmaster)
admin can utilize all menu or sub menu in Main Menu.
Headmaster have same …

Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean that when user finished login, user access
a form in accordance with the rules?