Jx_Man 987 Nearly a Senior Poster Featured Poster

I never do this before. so i can't give you more advice.
At least you know how to lock the folder. Maybe is a challenge for you to make it locked with password..

Jx_Man 987 Nearly a Senior Poster Featured Poster

Add icon to imagelist.
use icon picture (.ico) and change the "view" to "0-lvwIcon" on listview properties
assign icon image from imagelist to listview.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i don't get what you want exactly

Jx_Man 987 Nearly a Senior Poster Featured Poster

post a couple ID examples..

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long,ByVal pszRootPath As String,ByVal dwFlags As Long) As Long
Private Const SHERB_NORMAL = &H10
Private Const SHERB_NOCONFIRMATION = &H1
Private Const SHERB_NOPROGRESSUI = &H2
Private Const SHERB_NOSOUND = &H4
Private Const SHERB_NOALL = _
(SHERB_NOCONFIRMATION And _
SHERB_NOPROGRESSUI And SHERB_NOSOUND)

Dim RetVal As Long
Private Sub Command1_Click()
   Dim y as Integer
   y = MsgBox("Are u sure to clean up Recycle Bin ? ", vbYesNo, "Confirmation"
   If y = vbYes Then
      RetVal = SHEmptyRecycleBin(0&,vbNullString,&H1)
   MsgBox "Recycle Bin has been cleaned"
   End If
End Sub
Vega_Knight commented: Worked Perfectly +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

FolderName =Inputbox("Enter Folder Name","Folder Name")
FileName =Inputbox("Enter File Name","File Name")

Const bytesToMb = 1048576

Set objFSO = CreateObject("Scripting.FileSystemObject")

ShowSubFolders objFSO.GetFolder(FolderName)

Sub ShowSubFolders(Folder)

    temp = 0 
    For Each file In Folder.Files
        Set objCurFile = objFSO.GetFile(file)
        If UCase(objCurFile.Name) = UCase(FileName) Then  
            temp = temp + 1
            strFile = Folder & "\" & FileName
        End If
    Next

    Set objFile = objFSO.GetFile(strFile)

    If temp > 0 Then
        wscript.echo "File Size: " & Round(objFile.Size / bytesToMb, 2) & " Mb"
    Else
        WScript.Echo "File does not exist"
    End if

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

I'm currently using Avast antivirus and there's nothing alert when i run the compiled application.
I don't know if this happen caused by portable vb6 since i'm using the full installation.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Brother we cannot found any code to solve my thread to this website please
tell me another idea

Yes, But there are red button to download source code about how to lock folder.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Add Reference : Microsoft Script Runtime
Add 1 label.

Private Sub SysInfo1_DeviceArrival(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
Call Check
End Sub

Private Sub SysInfo1_DeviceRemoveComplete(ByVal DeviceType As Long, ByVal DeviceID As Long, ByVal DeviceName As String, ByVal DeviceData As Long)
Call Check
End Sub

Private Sub Check()
Dim FSO As New Scripting.FileSystemObject, drv As Scripting.Drive
'No Usb Detected
Label1.Caption = "Drive : -"

For Each drv In FSO.Drives
    If drv.IsReady Then
        If drv.DriveType = Removable Then
            Label1.Caption = drv.DriveLetter & ":"

        End If
    End If
Next
End Sub

Private Sub Timer1_Timer()
Call Check
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try to using API Fucntion instead of shell function :

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Function pathOfFile(fileName As String) As String
    Dim posn As Integer
    posn = InStrRev(fileName, "\")
    If posn > 0 Then
        pathOfFile = Left$(fileName, posn)
    Else
        pathOfFile = ""
    End If
End Function

Private Sub Command1_Click()
    Dim myPath As String
    myPath = "D:\Dani\result.png"
    ShellExecute 0, vbNullString, pathOfFile(myPath), vbNullString, vbNullString, 1
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Is this thread has been resolved?
Plase mark it As SOLVED if it already finished.
If not then post your feedback.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Just FYI, the link: http://www.daniweb.com/stats/toplist is broken for me.

I've got some error too. It makes me automatically log out after click that link.

Jx_Man 987 Nearly a Senior Poster Featured Poster

After 39 posts, I think mitja explain more detail and easy to understand than OP. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

but their is an error saying that it is invalid password

It means your password in connection is wrong.
change this MyDbPassword with your own password.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Regal Biscuit Marie with mineral water..

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
    Dim temp() As String = Split(TreeView1.SelectedNode.Text, "-")
    TextBox1.Text = Trim(temp(0).ToString)
    TextBox2.Text = Trim(temp(1).ToString)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

It should be like this :

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;

For more information see this site

Jx_Man 987 Nearly a Senior Poster Featured Poster

Using what db?
post your connection code.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Public Function ChangeFileExt(ByVal FileName As String, ByVal Extention As String)
 Dim str() As String, NewFile As String
 If InStr(1, FileName, ".") Then
     str = Split(FileName, ".")
     NewFile = Replace(FileName, str(UBound(str)), Extention)
     Name FileName As NewFile
 Else
     Name FileName As FileName & "." & Extention
 End If
End Function

Private Sub Command1_Click()
Call ChangeFileExt("D:\test.jx", "txt")
End Sub

Or you can use another technique in this post

Sawamura commented: Awesome!!!! +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this help :

Private Sub ListFiles(strPath As String, Optional Extention As String)
'Leave Extention blank for all files'
    Dim File As String

    If Right$(strPath, 1) <> "\" Then strPath = strPath & "\"

    If Trim$(Extention) = "" Then
        Extention = "*.*"
    ElseIf Left$(Extention, 2) <> "*." Then
        Extention = "*." & Extention
    End If

    File = Dir$(strPath & Extention)
    Do While Len(File)
        List1.AddItem File
        File = Dir$
    Loop
End Sub

Private Sub Command1_Click()
    ListFiles "D:\musicfolder", "*" 
    ' Or ListFiles "D:\musicfolder", "" leave it blank to get all files'
End Sub

See this thread

Sawamura commented: Worked nice :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try :

    Dim diffrence As TimeSpan
    diffrence = DateTime.Parse(ComboStartTime.SelectedItem.ToString) - DateTime.Parse(ComboEndTime.SelectedItem.ToString)
    Select Case diffrence.TotalMinutes.ToString
        Case 30, 45, 50, 60
            MsgBox("true")
        Case Else
            MsgBox("false")
    End Select
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub ClearCombo(ByVal MyCombo As ComboBox)
    MyCombo.Clear
End Sub

Private Sub ClearCombo_Click()
Dim Temp As Control
For Each Temp In Me.Controls
    If TypeOf Temp Is ComboBox Then
        Temp.Text = ""
        ClearCombo Temp
    End If
Next
End Sub
Sturdy commented: Solved +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try :

Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
    Dim i As Integer = DataGridView1.CurrentRow.Index
    txttID.Text = DataGridView1.Item(0, i).Value
    txttSurname.Text = DataGridView1.Item(1, i).Value
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Okay. Set Axis X and Y :

Private Sub Form_Load()
    MSChart1.RowCount = 15 'Set Column Number'
    MSChart1.Plot.Axis(VtChAxisIdY).CategoryScale.Auto = False
    MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 100 'Set X scale'
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub ClearCombo(ByVal MyCombo As ComboBox)
    MyCombo.Items.Clear()
End Sub

For Each ccontrol In Me.Controls
    If TypeOf ccontrol Is ComboBox Then
        ccontrol.Text = ""
        ClearCombo(ccontrol)
    End If
Next ccontrol
Jx_Man 987 Nearly a Senior Poster Featured Poster

Sorry i was ill, some quries as still pending.

1. How to cahnge column name in MSFlexgrid?

2. How to delete a Selected Row?

3. Suppose i have a text box and i enter then click on search button to show Record in MSFlexGrid?

5. How to udpade a selected record?

6. How to clear the Contents of Flex Grid, i mean when i click on save button it should clear the Grid.

I think, i give you more than enough..
How about make some effort for your each questions and post your own code.
Until now, i didn't see any single codes from you..
You always ask more and more questions without showing some effort. You just drive me to writing all the codes for you.

Jx_Man 987 Nearly a Senior Poster Featured Poster

for the X axis i need to set 0 in the middle of the picture other then 0 to 100

what you mean about this? it's more like termometer?

     6
     4
     2
     0
    -2
    -4
    -6
Jx_Man 987 Nearly a Senior Poster Featured Poster

To limit your retrieved data from database you use TOP clause in your sql statement.
You can read in this site.

Select TOP 50 * from Customers
Sturdy commented: Worked Perfectly +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Can you show your sql query to retrieve customers from database?

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Private Sub FindMySpecificString(ByVal searchString As String)
    ' Ensure we have a proper string to search for.'
    If searchString <> String.Empty Then
        ' Find the item in the list and store the index to the item.'
        Dim index As Integer = listBox1.FindStringExact(searchString)
        ' Determine if a valid index is returned. Select the item if it is valid.'
        If index <> ListBox.NoMatches Then
            listBox1.SetSelected(index, True)
        Else
            MessageBox.Show("The search string did not find any items in the ListBox that exactly match the specified search string")
        End If
    End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    FindMySpecificString(TextBox1.Text)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this help :

    Function pathOfFile(fileName As String) As String
        Dim posn As Integer
        posn = InStrRev(fileName, "\")
        If posn > 0 Then
            pathOfFile = Left$(fileName, posn)
        Else
            pathOfFile = ""
        End If
    End Function

Call it using Shell() Function :

Private Sub Command1_Click()
    Dim myPath As String
    myPath = "D:\Dani\result.png"
    Shell "explorer " & pathOfFile(myPath)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
  1. I want to check if record already exists in db before inserting new record?
  2. Can i have column name with out under score e.g
  1. Just do small modification in saving codes. Binding all data in flexgrid and compare it with data in db.

    Private Sub Command1_Click()
    Access_Connector ' Connect to access'
    
    With FlxGrdDemo
        For i = 1 To .Rows - 1
    
            Set rs = Nothing
            Set rscheck = Nothing
            Set rs = New ADODB.Recordset
            Set rscheck = New ADODB.Recordset
    
            rs.Open "SELECT * from Authors", Conn, adOpenStatic, adLockOptimistic
            rscheck.Open "SELECT * from Authors where Au_id = " & FlxGrdDemo.TextMatrix(i, 0), Conn, adOpenStatic, adLockOptimistic
    
            If rscheck.RecordCount > 0 Then
                MsgBox "AU_ID '" & .TextMatrix(i, 0) & "' already in database"
            Else
                rs.AddNew
                rs!au_id = .TextMatrix(i, 0)
                rs!Author = .TextMatrix(i, 1)
                rs.Update
                MsgBox "Data added", vbInformation, "Add Data"
            End If
        Next i
    
    
    rs.Close
    rsCheck.Close
    Conn.Close
    End With
    End Sub
    
  2. I think there are codes about Autowidth of column size in last of LoadData procedure. Read the code! Learning it! don't just copy and paste without understanding it!!.
    Do small modification (again!!) in your form load event :

    Private Sub Form_Load()
    With FlxGrdDemo
        .Cols = 2
        .Rows = 2
        .FixedCols = 0
        .TextMatrix(0, 0) = "Au_Id"
        .TextMatrix(0, 1) = "Author"
    
        'This following codes for autowidth of column size!!!'
        For i = 0 To .Cols - 1
            .ColWidth(i) = TextWidth(.TextMatrix(0, i)) + 300
        Next i
    End With
    
    
    LoadData
    End Sub
    
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use looping to read all data.

While (acsdr.Read())
ComboBox2.Items.Add(acsdr("Sections"))
End While
november_pooh commented: True +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're welcome :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

In vb we put comments in codes using single quote in front of comment without close it at the end of comments. Ex : 'This Will be a comments
But something wrong if i don't close it with single quote too. All codes after comments will become like comments until i close it with single quote.

This is a try :

'This is a comments
Dim i as Integer ' declare i as integer type
Dim j as String

For i = 0 to 5 ' This comments too
   Msgbox i 
Next i

It makes me must to close my comments with single quote if i want to post the codes in VB section.

'This is a comments'
Dim i as Integer ' declare i as integer type'
Dim j as String

For i = 0 to 5 ' This comments too'
   Msgbox i 
Next i

Thank You.

Jx_Man 987 Nearly a Senior Poster Featured Poster

In vb we put comments in codes using single quote. But something wrong if i don't close it with single quote too.
'This is a comments
Dim i as Integer ' declare i as integer type
Dim j as String
For i = 0 to 5 ' This comments too
Msgbox i
Next i

Please just ignoring the last statement. It just for a test.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I'm really in good mood right now. i write a simple code about how to add data to flexgrid and save it, also load it to flexgrid.
For edit and delete? do it by yourself. since 265 posts you should know about daniweb rules :)

Add references : Microsoft ActiveX Data Object 2.5 Library
Add 2 flexgrid : FlxGrdDemo for input data and FlxGrdDemo2 for load data.
Add 2 button for save and load.

After from load you can see default data in database. Just add new Au_Id and Author in first flexgrid. Use Keyboard Arrow to move and Enter to make new row.

Public Conn As New ADODB.Connection

Private Sub Access_Connector()
    Dim db_file As String

    ' Get the data.'
    db_file = App.Path
    If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
    db_file = db_file & "Authors.mdb"

    Set Conn = New ADODB.Connection
    Conn.ConnectionString = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & db_file & ";" & _
        "Persist Security Info=False"
    Conn.Open
End Sub

Private Sub LoadData()

    Dim c As Integer
    Dim r As Integer
    Dim col_wid() As Single
    Dim field_wid As Single

    Access_Connector ' Connect to access'

    Set rs = New ADODB.Recordset
    rs.Open "SELECT * from Authors", Conn, adOpenDynamic, adLockBatchOptimistic

    ' Use one fixed row and no fixed columns.'
    FlxGrdDemo2.Rows = 2
    FlxGrdDemo2.FixedRows = 1
    FlxGrdDemo2.FixedCols = 0

    ' Display column headers.'
    FlxGrdDemo2.Rows = 1
    FlxGrdDemo2.Cols = rs.Fields.Count
    ReDim col_wid(0 To rs.Fields.Count - 1)
    For c = 0 To rs.Fields.Count - 1
        FlxGrdDemo2.TextMatrix(0, c) = …
Sawamura commented: You should get paid for this codes +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You mark this thread as solved but you ask a help??

but it always make timer1.enalbe true

Your first code is working. you just need select the item on listbox to get timer enable as False.

i tried this but its always gives false reslut please help me D:
If ListBox1.Items.Count > 0 Then
Me.Text = "i select empty part of listbox = falsee"
Else
Me.Text = "true"
End If

I don't get what you want in your second code. If your listbox is fill with an items then this code will always return False. Even you select an empty part of listbox.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

Yes, You need to download the ODBC connector.
Here is the link :
http://dev.mysql.com/downloads/connector/odbc/5.1.html#win32

Naruse commented: Thanks +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

below is my vb6.0 code. the click command is to save my text and picture. there is no problem for my text. but, i have a problem after saving the picture. the picture can be saved but it is not availabe for preview. is there any fix for this ?

To save picture in PictureBox you should use SavePicture() function :

Dim namefile2
namefile = App.Path & ("/" & Text1 + Text2) & ".bmp"
SavePicture Picture1.Image, namefile
dnk commented: :D +1
Neji commented: - +1
debasisdas commented: agree +13
Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't understang what are your trying to do. But seems you want to make a line chart.
Why you don't use Microsoft Chart Control?
Go to Project->Component->Mircrosoft Chart Control 6.0

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

change what?
Provide more information. explain more.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Good. :D
Don't Forget to mark this thread as Solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

it does not work! but thank you! i found a way!

Hi huskarit,

Thats great that you found the way to solve your problem.
So, Would you like to share the way you solve it?
It will help another member who has same problem like you. Especially when they read this thread.

Thank You.

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
    Unload Me
End If
End Sub
Estella commented: helper +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

what kind of error?
post a complete code and which line of error came up.

Jx_Man 987 Nearly a Senior Poster Featured Poster

like this ?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    TextBox1.Enabled = False
    ComboBox1.Enabled = False
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't get what you want to exactly.
Please more specify.