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

Try something like this :

    Function FileText(ByVal filename As String) As String
        Dim handle As Integer

           ' ensure that the file exists
        If Len(Dir$(filename)) = 0 Then
            Err.Raise 53  ' File not found
        End If

           ' open in binary mode
        handle = FreeFile
        Open filename$ For Binary As #handle
           ' read the string and close the file
        FileText = Space$(LOF(handle))
        Get #handle, , FileText
        Close #handle
    End Function

Private Sub Command1_Click()
    Text1.Text = FileText("D:\image.txt")
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're welcome.
Don't forget to mark this thread as solved

Jx_Man 987 Nearly a Senior Poster Featured Poster

yes sir.

Then use sql query to delete it and refresh it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

this is connected to database?

Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
    MsgBox(e.KeyChar & " key is pressed")
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Add this foloowing function :

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
    If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
        MsgBox("Enter")
        Return True
    End If
    Return MyBase.ProcessCmdKey(msg, keyData)
End Function
Jx_Man 987 Nearly a Senior Poster Featured Poster

Currently, I have 3 listboxs' data, but I don't know how to create 3 columns and show them with datagrid control.
Does anyone give me a guid line how to show listbox's data with datagrid?

You can fill recordset with listbox items then you can set datagrid source with current recordset.

see this example :

Private Sub Command1_Click()
Dim rsTest As New ADODB.Recordset

' create new column in recordset named listbox1, listbox2, listbox3
' every column has unique name

With rsTest.Fields
.Append "Listbox1", adBSTR
.Append "Listbox2", adBSTR
.Append "Listbox3", adBSTR
End With

rsTest.Open
For i = 0 To List1.ListCount

' add every listbox items into each column

    With rsTest
        .AddNew
        .Fields("Listbox1") = List1.List(i)
        .Fields("Listbox2") = List2.List(i)
        .Fields("Listbox3") = List3.List(i)
        .Update
    End With
Next i

Set DataGrid1.DataSource = rsTest
End Sub

Private Sub Form_Load()
With List1
    For i = 1 To 10
        .AddItem i
    Next i
End With

With List2
    For j = 11 To 20
        .AddItem j
    Next j
End With

With List3
    For k = 21 To 30
        .AddItem k
    Next k
End With

End Sub

1da39ad35d02cd7d27315d1fb6cad87f

TnTinMN commented: nice example +8
Jx_Man 987 Nearly a Senior Poster Featured Poster

A nut for a jar of tuna

That makes sense.
@reverend jim and scidzilla : Thanks for correcting
@Aura : this following codes is modified with other members suggestion :

Function RemoveNonLetterChar(theString)
    strAlphaNumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    For i = 1 To Len(theString)
        strChar = Mid(theString, i, 1)
        If InStr(strAlphaNumeric, strChar) Then
            CleanedString = CleanedString & strChar
        End If
    Next
    RemoveNonLetterChar = CleanedString
End Function

Private Sub Command1_Click()
    Dim Temp, Palindrome As String

    Temp = LCase(RemoveNonLetterChar(Text1.Text)) 'lower case and remove non letters char
    Palindrome = StrReverse(Temp)

    If StrComp(Temp, Palindrome, vbTextCompare) = 0 Then
        MsgBox "Palindrome!"
    Else
        MsgBox "Not a Palindrome!"
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

If you were to check the phrase "Able was I ere I saw Elba" without normalizing it would not be flagged as a palindrome. After normalizing it would be "ablewasiereisawelba" which would be flagged as a palindrome.

Nope. It also recognized as palindrome. StrReverse will completed reverse the words included the space.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Use StrReverse() function to reserve the word/phrase. Compare the real words/phrase with reserved words/phrase.
Check out the result if it same or not.

Private Sub Command1_Click()
    Dim Palindrome As String

    Palindrome = StrReverse(Text1.Text)

    If StrComp(Text1.Text, Palindrome, vbTextCompare) = 0 Then
        MsgBox "Palindrome!"
    Else
        MsgBox "Not a Palindrome!"
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try :

For Each Control In Me.Controls
    If TypeOf Control Is TextBox Then
        Control.Text = ""
    End If
Next Control
Jx_Man 987 Nearly a Senior Poster Featured Poster

Change :

txtStudentId.DataField = "student_Id"
txtStudentFirstName.DataField = "student_firstName"
....

To :

txtStudentId.DataField = rs!student_Id
txtStudentFirstName.DataField = rs!student_firstName
....

Or :

txtStudentId.DataField = rs.Fields("student_Id").Value
txtStudentFirstName.DataField = rs.Fields("student_firstName").Value
....
Jx_Man 987 Nearly a Senior Poster Featured Poster

Confused here. I can't understand what you want exactly.
You can't edit data in datagrid or you can't show data to the textboxes?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Well,,you're the one who know which the best.
I give an example of trasnferin data from flexgrid to listview & datagrid.
Modified it as u needed
trasnfer

Jx_Man 987 Nearly a Senior Poster Featured Poster

What you mean about using datagrid or listview?
Transfered it from flexgrid to datagrid/listview or using datagrid/listview for all operation?

Jx_Man 987 Nearly a Senior Poster Featured Poster

I think Without a new row your no 1 problem will appear again.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try :

Private Sub grid1_Click()
    With grid2
        a = grid2.Rows - 1
        b = grid1.RowSel

        For j = 1 To grid1.Cols - 1
            grid2.TextMatrix(a, j) = grid1.TextMatrix(b, j)
        Next j
        .AddItem ""
    End With
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're welcome.
Don't forget to mark this thread as Solved.
Happy Coding.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Ok. So when you type on textbox then there are data display on datagrid.
Use textbox change event to make searching every you type a word on textbox.
This is an example of searching using datagrid. Modified as you needed.

Private Sub Text1_Change()
 Set rs = New ADODB.Recordset
        rs.CursorType = adOpenDynamic
        rs.LockType = adLockOptimistic
        rs.Open "SELECT * FROM Login where fname  like " & "'%" & Text1.Text & "%'", Conn, , , adCmdText

    Set DataGrid1.DataSource = rs
    DataGrid1.Columns(0).Width = 2000
    DataGrid1.Columns(1).Width = 2000

    DataGrid1.AllowAddNew = False
    DataGrid1.AllowArrows = True
    DataGrid1.AllowDelete = False
    DataGrid1.AllowUpdate = False
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

how to search in datagrid where every keyword you type wil display the record
found in database?

You want to search in datagrid or search record in database?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub cmdDelete_Click()
    Dim con As ADODB.Connection
    Set con = New ADODB.Connection
    Dim rsDelete As ADODB.Recordset
    Set rsDelete = New ADODB.Recordset
    Dim Query As String

    If MsgBox("Are you sure you want to delete?", vbYesNo, "Santo Niño Census Info System") = vbYes Then
        Query = "DELETE FROM Users WHERE IdUser ='" & Trim(txtId) & "'"
        con.Execute Query, , adCmdText
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
Estella commented: Nice site +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Andre shown how to add header and display it in report style.
Below is how to display data into listview using access and adodb.
Modified as you need and show to us how it work..

Private Sub ShowData()
    Dim con As ADODB.Connection
    Set con = New ADODB.Connection
    Dim rsShow As ADODB.Recordset
    Set rsShow = New ADODB.Recordset
    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\project.MDB;Persist Security Info=False"

    rsShow.Open "SELECT * FROM Student ", con, adOpenStatic, adLockOptimistic
    ListView1.ListItems.Clear

    While Not rsShow.EOF
        Set View = ListView1.ListItems.Add
        View.Text = rsShow!ID
        View.SubItems(1) = rsShow!LastName
        View.SubItems(2) = rsShow!FirstName
        View.SubItems(3) = rsShow!MiddleName
        View.SubItems(4) = rsShow!Age
        View.SubItems(5) = rsShow!Sex
        'and soon
        rsShow.MoveNext
    Wend
    rsShow.Close
    con.Close
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Its not a problem when you use datagrid or listview. The pressure point is how you'll get searching data from database (exact or like), it will influence how you display the result. if you want display the exact result then you can use textbox to display it like andre solution.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't know where you display the searching data. But i give an example searching with listview.
Try this example :

Private Sub cmdSearch_Click()
    Dim con As ADODB.Connection
    Set con = New ADODB.Connection
    Dim rsSearch As ADODB.Recordset
    Set rsSearch = New ADODB.Recordset
    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\ListofMembers.MDB;Persist Security Info=False"

    rsSearch.Open "SELECT * FROM Census WHERE ID LIKE " & "'%" & Text1.Text & "%'", con, adOpenStatic, adLockOptimistic
    ListView1.ListItems.Clear

    While Not rsSearch.EOF
        Set View = ListView1.ListItems.Add
        View.Text = rs!ID
        View.SubItems(1) = rs!LastName
        View.SubItems(2) = rs!FirstName
        View.SubItems(3) = rs!MiddleName
        View.SubItems(4) = rs!Age
        View.SubItems(5) = rs!Sex
        'and soon
        rsSearch.MoveNext
    Wend
    rsSearch.Close
    con.Close
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

First, your code is not running. You missing 's' in every ListItems and SubItems statements.

Second, As default you can't select entire rows. It's because version 5.0 (SP2) does not support it.
but if you use version 6.0, your listview will able to do that with set FullRowSelect = true.
In your case you can SendMessage to add this behavior :

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

Const LVS_EX_FULLROWSELECT = &H20
Const LVM_FIRST = &H1000
Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + &H37
Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + &H36


Private Sub Form_Load()
'Using api function
Dim lStyle As Long
lStyle = SendMessage(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
lStyle = lStyle Or LVS_EX_FULLROWSELECT
Call SendMessage(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal lStyle)


ListView1.ListItems.Add , , 111
ListView1.ListItems(ListView1.ListItems.Count).SubItems(1) = "apple"
ListView1.ListItems(ListView1.ListItems.Count).SubItems(2) = "100"
ListView1.ListItems.Add , , 222
ListView1.ListItems(ListView1.ListItems.Count).SubItems(1) = "mango"
ListView1.ListItems(ListView1.ListItems.Count).SubItems(2) = "200"

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

1 Textbox, 1 Button. Result showing in form caption :

Private Sub Command1_Click()
    Dim TextLines As Variant
    TextLines = Split(Text1, vbNewLine)
    Form1.Caption = "Sockz-" & (UBound(TextLines) + 1)
End Sub
debasisdas commented: agree +13
Naruse commented: agree +2
Sturdy commented: :D +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use UCase() or LCase () function. all string will be converted to upper or lower string

If UCase(Text1.Text) = UCase("red") And Label4.BackColor = vbRed Then
    score = score + 1
    Label6.Caption = score
End If

or if you just want to make uppercase the first string

mystring = Text1.Text
If (UCase(Left(mystring, 1)) & Right(mystring, Len(mystring) - 1)) = "Red" Then
    score = score + 1
    Label6.Caption = score
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

I believe that problem is Picture_Name.
You put Picture_Name in your insert statement but it never been declared in CmdSave.
Why you don't use lblPicture_Name? it hold picture name too.

Conn.Execute "INSERT INTO Ministers_AccountTB(User_Name,Password,Prefix,Privilege,Passport) VALUES ('" & txtUser_Name.Text & "','" & txtRetype_Password.Text & "','" & cmbPrefix.Text & "','" & cmbPrivilege.Text & "','" & lblPicture_Name.Caption & "')"
Jx_Man 987 Nearly a Senior Poster Featured Poster

ASP.Net

Jx_Man 987 Nearly a Senior Poster Featured Poster

All projects use .Net 2.0, 3.0, 3.5, or 4.0
You can change the version in Project Properties -> Compile -> Advanced Compile Option

Jx_Man 987 Nearly a Senior Poster Featured Poster

Ok. Don't forget to mark this thread as solved

Jx_Man 987 Nearly a Senior Poster Featured Poster

Bad file name or Number

this means your file is not exist. make sure your fle is exist and Check your path is typed correctly.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Yes. It means every you added new path the same icon will shown.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi,
Set BorderStyle of the form to :
1 -Fixed Single

Regards
Veena

@ veena : I think the OP was do that.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Make sure your file to delete is exist.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Add one icon with dimension 16x16 to Imagelist.
Then add this code :

Private Sub Command1_Click()
On Error Resume Next

    With ListView1
        Set .Icons = ImageList
        Set .SmallIcons = ImageList
        Set View = .ListItems.Add(, , , 1, 1) ' Icon Added
        View.SubItems(1) = "This/Where/Path/Added/" & .ListItems.Count 'Path Added
        View.SubItems(2) = "Size " & .ListItems.Count 'Size Added
    End With
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You can capture the form resizing event then set the form into normal size.

Private Sub Form_Resize()
    If (Me.WindowState <> vbMinimized) Then
        Me.Width = 4800
        Me.Height = 3600
    End If
End Sub

And set max button to false.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Your question is same as before. did u tried what i said above?

Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean every added any path then there are icon set in left side of that items?

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

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

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.