Jx_Man 987 Nearly a Senior Poster Featured Poster

yes, there are another way to do that. use a key ascii to handle it. so user didn't allowed to input numeric data.
try this code :

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case 65 To 90, 8 ' A-Z and backspace
        'Let these key codes pass through
        Case 97 To 122, 8 'a-z and backspace
        'Let these key codes pass through
        Case Else
        'All others get trapped
        KeyAscii = 0 ' set ascii 0 to trap others input
    End Select
End Sub

Hope this helps...

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi Geeta...
I was Modified your code, please looking carefully :
I used One textBox Named txtSearchKey and Button Named btnSearch
i made LoadData procedure to display data in datagrid at first form loaded.
Look for declaration and assignment...

Dim con As New OleDb.OleDbConnection
    Dim cmdOle As New OleDb.OleDbCommand
    Dim dsOle As New DataSet
    Dim da As New OleDb.OleDbDataAdapter
    Dim dtOle As New DataTable
    Dim sql As String

    Private Sub LoadData()
        con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source= C:\Dentistry.mdb")
        Try
            cmdOle = con.CreateCommand
            cmdOle.CommandText = "SELECT * FROM PatientDetails" ' This Table name
            da.SelectCommand = cmdOle
            da.Fill(dsOle, "PatientDetails") ' This Table Name
            dgAuthor.DataSource = dsOle
            dgAuthor.DataMember = "PatientDetails" ' This table Name
            dgAuthor.ReadOnly = True
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try

    End Sub
    Private Sub Search_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadData
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

        con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source= C:\Dentistry.mdb")
        Try
            dsOle.Clear()
            dtOle.Clear()
            cmdOle = con.CreateCommand
            cmdOle.CommandText = "SELECT * FROM PatientDetails where FirstName LIKE '%" & Trim(txtSearchKey.Text) & "%'" 
            da.SelectCommand = cmdOle
            da.Fill(dsOle, "PatientDetails") ' This Table name
            dgAuthor.DataSource = dsOle
            dgAuthor.DataMember = "PatientDetails" ' This Table name
            dgAuthor.ReadOnly = True

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

So if you input eg : "w" in txtSearchKey...program will search every name …

Jx_Man 987 Nearly a Senior Poster Featured Poster

using Focus() function...
try this code :

If DropDown.SelectedItem = "Yes" Then
      TextBox1.Focus() ' If Yes go to textbox1
Else
      TextBox2.Focus() ' If No go to textbox2
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

you're Welcome...
Don't forget to mark this thread solved.
Happy Coding Friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

Add in your declaration :

Const MAX_PATH As Integer = 260
EkoX commented: :twisted: +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

set BorderStyle of Form properties to None

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

so, its already generated and stored.
so u just load the id from database.

Jx_Man 987 Nearly a Senior Poster Featured Poster

use picture box or image. then use that code to show it.

Picture1.Picture = LoadPicture("F:\Pictures\Icon\CloseX.ico")
Jx_Man 987 Nearly a Senior Poster Featured Poster

Picture1.Picture = LoadPicture("F:\Pictures\Icon\CloseX.ico")

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

you mean, display photo from folder?

Jx_Man 987 Nearly a Senior Poster Featured Poster

yeah, i know that. i mean that id pattern.
ex : UK1000
UK1001.

Jx_Man 987 Nearly a Senior Poster Featured Poster

give an example of id?

Jx_Man 987 Nearly a Senior Poster Featured Poster

varCommand = New SqlCommand("insert into tbl_rop values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "',)", varConnection)

Wrong code, where u want to insert?what column Name of table?
eg :

cmdStudent1.CommandText = "INSERT INTO Student(Id, FirstName, LastName,Age) VALUES('" & Trim(txtId.text) & "','" & Trim(txtFirstName.Text) & "','" & Trim(txtLastName.Text) & "','" & Trim(txtAge.Text) & "')"
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi..
File ->Make YourProjectName.Exe

Jx_Man 987 Nearly a Senior Poster Featured Poster

have u a searching procedure?? i mean, you can display on datagrid. post it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

maybe using text file to save setting...

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi...welcome to Daniweb Peter :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

use tab index to set cursor on current text box.
setfocus cannot be called in form load. just in procedure or function.

Vega_Knight commented: right +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

add this code to module to connected sqlserver with vb.net:

Imports System.Data
Imports System.Data.SqlClient

Module Koneksi
    Public conn As SqlConnection
    Public Function GetConnect()
        conn = New SqlConnection("server = MyServerName;database = MyDatabaseName;Trusted_Connection = yes")
        Return conn
    End Function
End Module

add this code to button event click :

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Dim check As Integer
        Dim conn As SqlConnection
        Dim cmdStudent As New SqlCommand
        Dim cmdStudent1 As New SqlCommand
        Dim daStudent As New SqlDataAdapter
        Dim dsStudent As New DataSet
        Dim dtStudent As New DataTable

        If txtId.text = "" Or txtFirstName.Text = "" txtLastName.Text = "" Or txtAge.Text = "" Then
            MsgBox("Student Data is not completed", MsgBoxStyle.OKOnly)
        Else
            If MsgBox("Are you sure to save Student data with Id : " & txtId.text & " ?", MsgBoxStyle.OKCancel, "Input confirm") = MsgBoxResult.Cancel Then
                ' do nothing
            Else
                Try
                    conn = GetConnect()
                    conn.Open()
                    cmdStudent = conn.CreateCommand
                    cmdStudent.CommandText = "SELECT * FROM Student WHERE Id='" & Trim(txtId.text) & " ' "
                    daStudent.SelectCommand = cmdStudent
                    daStudent.Fill(dsStudent, "Student")
                    dtStudent = dsStudent.Tables("Student")

                    If (dtStudent.Rows.Count > 0) Then
                        MsgBox("Student dengan Id " & Trim(cmbId.Text) & " already in database", MsgBoxStyle.OKOnly, "Message :")
                    Else
                        
                        cmdStudent1 = conn.CreateCommand
                        cmdStudent1.CommandText = "INSERT INTO Student(Id, FirstName, LastName,Age) VALUES('" & Trim(txtId.text) & "','" & Trim(txtFirstName.Text) & "','" & Trim(txtLastName.Text) & "','" & Trim(txtAge.Text) & "')"
                        check = cmdStudent1.ExecuteReader.RecordsAffected()
                        If check > 0 Then
                            MsgBox("Student With Id " & Trim(cmbId.Text) & " succesfully to added", MsgBoxStyle.OKOnly, "Message :")
                        Else
                            MsgBox("Student With Id " & Trim(cmbId.Text) …
november_pooh commented: Nice code +1
ITKnight commented: how great this code :) +1
Vega_Knight commented: nice one... +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

# To add a Date Time Picker control, on the Toolbox, click the More Controls button
# Scroll down in the list of controls, click Microsoft Date and Time Picker 6.0 (SP4), and click the form.
see this tutorial

Jade_me commented: great link +1
november_pooh commented: Yesh +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i tried this with 2 listbox and 1 button. i was moved item on list2 to list5 and remove current item after moved.

Private Sub Form_Load()
With List2
    .AddItem ("1")
    .AddItem ("2")
    .AddItem ("3")
End With
Private Sub Command4_Click()
List5.AddItem List2.ItemData(List2.ListIndex)
List2.RemoveItem List2.ItemData(List2.ListIndex)
End Sub
End Sub
leedsy7 commented: always very helpfull:) +1
Neji commented: helpfull +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

everything is possible. In vb 6 you can direct access value from another form of any control (example is done by veena) but in .net you will find encapsulated form.

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :

Label1.Text = Microsoft.Visualbasic.Mid("November"3,3)
november_pooh commented: works like a charm +1
Neji commented: awesome +1
ITKnight commented: Great +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

use Microsoft Multimedia Control. find this control on component.
add this code to play mp3 file :

On Error GoTo ErrMsg
AxMMControl1.Wait = True
AxMMControl1.FileName = OpenFileDialog1.FileName
AxMMControl1.Command = "Open"
AxMMControl1.Command = "Play"
Exit Sub
ErrMsg:
     MsgBox(Err.Description)
End Sub
Naruse commented: thx +1
Sawamura commented: uhuy +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Maybe she want to found something that it has a connection with this site...
Don't worry...what she can do here is always about computer, programming, technology, what else... :)

Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Function ReturnNbrOfSelectedDataGridRows(ByVal dgSearchResults As DataGrid) As Integer
    Dim cm As CurrencyManager = DirectCast(Me.BindingContext(Me.dgSearchResults.DataSource, Me.dgSearchResults.DataMember), CurrencyManager)
    
    Dim dv As DataView = DirectCast(cm.List, DataView)
    
    Dim iRowCount As Integer = 0
    For i As Integer = 0 To dv.Count - 1
        
        If Me.dgSearchResults.IsSelected() Then
            iRowCount += 1
        End If
    Next
End Function
Jx_Man 987 Nearly a Senior Poster Featured Poster

did u have the search function before?
use like operator in your search clause..

Jx_Man 987 Nearly a Senior Poster Featured Poster

post the code, it will help much

Jx_Man 987 Nearly a Senior Poster Featured Poster
With lstReorder
    .AddItem (ITEM_NUMBER.Text)
    .AddItem (ITEM_DESCRIPTION_1.Text)
End With
Jade_me commented: nice +1
november_pooh commented: thanks +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

what kind of database?

Jx_Man 987 Nearly a Senior Poster Featured Poster

you can post all vb question in this section(vb6) but just for vb.net question like this thread please post on vb.net section.
and don't forget to mark this thread solved.
Happy coding friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

i was modified your code.
your messagebox parameter is not completed, that why errors coming out.

Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click

        Dim button As DialogResult

        button = MessageBox.Show _
        ("Are you sure you want to exit this application?", _
        "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)

        If button = Windows.Forms.DialogResult.Yes Then
            Me.Close()
        Else
        End If
    End Sub

btw this thread for vb.net question not for vb6...

Naruse commented: Good +1
Vega_Knight commented: Yupy +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

connect with database?what it is?
if used database binding in datagrid try with LIKE operator to searching more thorough.

Jx_Man 987 Nearly a Senior Poster Featured Poster

handle it with keydown event :

private void TextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
	if (e.KeyCode == Keys.Delete)
	{
		MessageBox.Show("you pressed delete key");
	}
}
Jade_me commented: Good +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Right Click on toolbar control (on form) -> select for properties -> Properties Pages will shown -> select for Buttons tab -> insert and remove button for toolbar there.
if steps right, this window on attachment will shown. (see an attachment for right click and Properties Pages Window)

Jx_Man 987 Nearly a Senior Poster Featured Poster

I added one line code...see the red one :

private void cmdtam_Klik(object sender, EventArgs e)
		{
			string cstr;
			cstr = "data source=knight;initial catalog=latihan;uid=sa;pwd=sri";
			SqlConnection con1 = new SqlConnection(cstr);
			con1.Open();
			SqlCommand com1 = new SqlCommand();
			com1.Connection = con1;
			com1.CommandType = CommandType.Text;
			com1.CommandText = "select * from customer"
			DataSet ds1 = new DataSet();
			SqlDataAdapter adp1 = new SqlDataAdapter(com1);
			adp1.Fill(ds1,"customer");
			grd1.DataSource = ds1;
                        grd1.DataMember = "customer";
			con1.Close();
		}

your code not set data source of data grid with your dataset(ds1)...

Hope this helps

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

After drag&Drop you will find toolbox without button.
Right click on toolbar->Properties->see for Button Tab.
In there you can insert button and remove as u want.

Jx_Man 987 Nearly a Senior Poster Featured Poster

This One :
Microsoft Windows Common Controls 6.0(SP6)

Jx_Man 987 Nearly a Senior Poster Featured Poster

There is no such component of name Microsoft Common Control 6.0

Oh...I m Sorry :)
i means Microsoft Windows Common Control 6.0

Jx_Man 987 Nearly a Senior Poster Featured Poster

why you do that. vb already have toolbar control. add toolbar on component.
Project->Component-> check on Microsoft Common Control 6.0 -> Apply it -> OK
you can see toolbar control on your toolbox

Jx_Man 987 Nearly a Senior Poster Featured Poster

so make a new button to clear all textbox like my suggestion on my previous post..

Private Sub btnClearForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearForm.Click
txtCustomerID.Text = ""
txtCustomerName.Text = ""
txtTelephoneNumber.Text = ""
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

no...when you click that your input will clear and none data will input...

Jx_Man 987 Nearly a Senior Poster Featured Poster

txtCustomerID.Text = ""
txtCustomerName.Text = ""
txtTelephoneNumber.Text = ""

why you put this code on your add New item event??
it will make none data to insert in database cause you have to clear them before you add them into db.
if you want to clear textbox make a new button to handle this.
ex:

Private Sub btnClearForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearForm.Click
txtCustomerID.Text = ""
txtCustomerName.Text = ""
txtTelephoneNumber.Text = ""
End Sub

So erase that codes from your input button.

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

i think that code is fine. any other mistake?
post your code...

Jx_Man 987 Nearly a Senior Poster Featured Poster

do you want to populate data in datagrid or other control (label or textbox).
i looks in your code you able to populate in datagrid. so try this to populate in textbox or label.
add this code on your code :

If myReader.HasRows Then	
	While myReader.Read()
		txtFirstName.text= myReader.Item("FirstName") 
	End While
End If
myReader.Close()
november_pooh commented: Got it :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

yes, here it is the code, try it and let me know if it worked :

Dim AllDir
Private Sub Form_Load()
On Error Resume Next
For i = 65 To 90
x = Dir(Chr(i) & ":\", vbDirectory + vbHidden + vbSystem)

If Err = 52 Then
    Err.Clear
Else
    If x <> "" Then AllDir = AllDir & (Chr(i) & ":\")
      Err.Clear
End If

Next i
MsgBox AllDir
End Sub

Hope this helps...

Neji commented: thank you very much. it was i looking for +1
Sawamura commented: worked +1
dnk commented: spontan uhuy +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

tell me if this code worked...

november_pooh commented: you know this code worked perfect +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code vega :

Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Private Type SYSTEM_INFO
    dwOemID As Long
    dwPageSize As Long
    lpMinimumApplicationAddress As Long
    lpMaximumApplicationAddress As Long
    dwActiveProcessorMask As Long
    dwNumberOrfProcessors As Long
    dwProcessorType As Long
    dwAllocationGranularity As Long
    dwReserved As Long
End Type
Private Sub Form_Load()
    Dim SInfo As SYSTEM_INFO
    'Set the graphical mode to persistent
    Me.AutoRedraw = True
    'Get the system information
    GetSystemInfo SInfo
    'Print it to the form
    MsgBox "Number of procesor:" + Str$(SInfo.dwNumberOrfProcessors) & vbCrLf & _
    "Processor:" + Str$(SInfo.dwProcessorType) & vbCrLf & _
    "Low memory address:" + Str$(SInfo.lpMinimumApplicationAddress) & vbCrLf & _
    "High memory address:" + Str$(SInfo.lpMaximumApplicationAddress)
    
    Unload Me
End Sub
Vega_Knight commented: Worked like charm +1
Estella commented: me :condused: +1
Sawamura commented: Approve +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

don't felt that, i really like your code.
i happy to know much from you too. you are the great coder, your code always help me and others. So, many alternative solution make it more completed.

Sawamura commented: very welcome :) +1