Jx_Man 987 Nearly a Senior Poster Featured Poster

Also CheckOnClick was not necessary because I already have that as “True” from the properties in designer.

Okay. I don't know it if you already set it.

So this is only working for items 1 to 5 and not for my own 68 items.

Yes, This only working for items with value 1 to 5. I just give the example. You modified it as you wish.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    For i As Integer = 1 To 5
        CheckedListBox1.Items.Add(i)
    Next

    CheckedListBox1.CheckOnClick = True 'Checked item when you select it
End Sub

Private Sub CheckedListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox1.SelectedIndexChanged
    If CheckedListBox1.SelectedItem.ToString = "1" Then
        Button1.Enabled = True
    End If   
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Set rsTest = New ADODB.Recordset

With
.Append "Field1", adBSTR
.Append "Field2", adBSTR
.Append "Field3", adBSTR
End With

rsTest.Open

With rsTest
.AddNew
.Fields("Field1") = "Test1"
.Fields("Field2") = "Test2"
.Fields("Field3") = "Test3"
.Update
End With
Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
End With
DataReport1.Refresh
DataReport1.Show 1
End Sub
Naruse commented: This snippet realy help me. Thank you :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You can check file name length..

Dim streamer As IO.StreamReader
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    OpenFileDialog1.ShowDialog()
    If OpenFileDialog1.FileName.Length > 0 Then
        TextBox1.Text = OpenFileDialog1.FileName
        streamer = IO.File.OpenText(TextBox1.Text)
        Dim mystring() As String = streamer.ReadToEnd.Split(vbNewLine)
        ListBox1.Items.AddRange(mystring)
    End If
End Sub
Aleksej commented: Thx Jx +1
Neji commented: As always +2
Jx_Man 987 Nearly a Senior Poster Featured Poster
Option Explicit
Dim X As Integer, Y As Integer 'Declare variable X and Y as Integer 

Private Sub Form_Load()
    ' This following code to assing variable X and Y with Width and Height of Form
    X = Me.Width 'assign variable X with form Width 
    Y = Me.Height 'assign variable Y with form Height
	
    'This following code to set Width and height of Form To 0
    Me.Width = 0 ' Set form Width to 0
    Me.Height = 0 ' Set form Height to 0
	
    ' This following to centered form
    Me.Left = (Screen.Width - Me.Width) / 2 ' Set Left with (Width of your computer screen -  Width of form) then Divide it by 2
    Me.Top = (Screen.Height - Me.Height) / 2 ' Set Top with (Height of your computer screen -  Height of form) then Divide it by 2
End Sub

'THis for Opened Form Animation
Private Sub Timer1_Timer()
 'Timer for the opening event
' This following code will  bringin back Form Size.. 
' form will increase width by 400 and Height by 350. So it will seems like animation..

' This following code will bring the Form Width Size
If Me.Width < X Then ' If Width of Form < X  (X is Form Width. Look at asiggnment in form load)
	Me.Left = (Screen.Width - Me.Width) / 2 'Set Left with (Width of your computer screen -  Width of form) then Divide it by 2. This for centered form
	Me.Width = Me.Width + 400 ' Form Width will …
Vega_Knight commented: Very good explanation +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub cmdAddItem_Click()
Static count As Integer
Static name As String
count = lstPoints.ListCount
count = count + 1
name = "Point " & count
lstPoints.AddItem name

If count = 8 Then
    cmdAddItem.Enabled = False
    cmdRemoveItem.Enabled = True
End If
End Sub

Private Sub cmdRemoveItem_Click()
Size = lstPoints.ListCount - 1
lstPoints.RemoveItem Size

If lstPoints.ListCount = 0 Then
    cmdRemoveItem.Enabled = False
    cmdAddItem.Enabled = True
End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Its not an error.
When you edit data your program will edit all record with name 'jones'.
Since you didn't have an key/Id to know which 'jones' to edit.
I suggest you to add Id Column as Key. So you can identifier which record to edit even they have the same name.
e.g :

Id  Surename  Forename Phone
1   jones     ward     12345
2   jones     ward     54321

Even they have same name but you can edit current jones with using their 'Id'.

ITKnight commented: Good point. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

1 Module, 1 textbox

In Module :

Option Explicit

Public OldWindowProc As Long

Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Const GWL_WNDPROC = (-4)
Public Const WM_USER = &H400
' Pass along all messages except the one that
' makes the context menu appear.
Public Function NoPopupWindowProc(ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_CONTEXTMENU = &H7B

    If msg <> WM_CONTEXTMENU Then _
        NoPopupWindowProc = CallWindowProc( _
            OldWindowProc, hWnd, msg, wParam, _
            lParam)
End Function

In Form :

Option Explicit
Private Sub Form_Load()
    ' Set the control's new WindowProc.
    OldWindowProc = SetWindowLong( _
        txtMenuDisabled.hWnd, GWL_WNDPROC, _
        AddressOf NoPopupWindowProc)
End Sub
' Restore the original WindowProc.
Private Sub Form_Unload(Cancel As Integer)
    SetWindowLong _
        txtMenuDisabled.hWnd, GWL_WNDPROC, _
        OldWindowProc
End Sub
Neji commented: Thank you. It worked very nice. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Info As New FileInfo("D:\000.jpg")
    MsgBox("Name : " & Info.Name & vbCrLf & _
        "Length : " & Info.Length & " bytes" & vbCrLf & _
        "Type : " & Info.Extension & vbCrLf & _
        "Date Created : " & Info.CreationTime & vbCrLf & _
        "Path : " & Info.DirectoryName & vbCrLf & _
        "Full Path : " & Info.FullName)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub Streching()
    Picture1.ScaleMode = 3
    Picture1.AutoRedraw = True
    Picture1.PaintPicture Picture1.Picture, _
        0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, _
        0, 0, _
        Picture1.Picture.Width / 26.46, _
        Picture1.Picture.Height / 26.46
    Picture1.Picture = Picture1.Image
End Sub

Private Sub Form_Load()
Streching
End Sub
Estella commented: To true.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Function to check if stack empty or not :

Private Function IsEmpty() As Boolean
    If Stacks.Count = 0 Then
        Return True
    Else
        Return False
    End If
End Function

how if I need to show these inputs (userMsg) in a (label) ? To find out what is the user entering (Pushing) into the stack

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    If IsEmpty() Then
        MsgBox("No elements in stack")
    Else
        Label1.Text = Stacks(0).ToString) 'Show the top of stack (last inputted data)
    End If
End Sub

what is going to be left after I (Pop) the items ?

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim i As Integer
    ListBox1.Items.Clear()
    If IsEmpty() Then
        MsgBox("No elements in stack")
    Else
        For i = 0 To Stacks.Count - 1
            ListBox1.Items.Add(MyStack(i).ToString) ' load all data in stack to listbox
        Next
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Where is your stack declaration? Dim Stack(4) As String -> Your Declaration is for array

You need to declare stack before add it. Dim MyStack as New Stack(4) -> This for Stack

To Add stack MyStack.Push(userMsg )

' Declare as global variable
Dim MaxSize As Integer = 4
Dim MyStack As New Stack(maxsize)

Private Sub Button1Push_Click(sender As System.Object, e As System.EventArgs) Handles Button1Push.Click
       
        Dim userMsg As String

        userMsg = InputBox("Push", "Stacks", "Enter your letter here", 500, 500)
        If MyStack.Count <= MaxSize Then
            MyStack.Push(userMsg)
        Else
            MsgBox("Stack is Full")
        End If
End Sub

Private Sub Button2Pop_Click(sender As System.Object, e As System.EventArgs) Handles Button2Pop.Click
    MsgBox(MyStack.Pop) ' Remove and return object at the top of stack
End Sub
Naruse commented: Really Good explanation +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub OpenFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFormToolStripMenuItem.Click
        Dim NewForm As New Form1
        NewForm.Show()
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
codeorder commented: .cool.link.:) +12
Jx_Man 987 Nearly a Senior Poster Featured Poster

You have 'typ' attribute. you can use it :

If ((resp = "y") Or (resp = "Y")) Then
    prequa = PrimePrice
    typ = "Premium"
Else
    prequa = RegularPrice
    typ = "Regular"
End If

Then change this line :

Console.WriteLine(vbLf & "Quality : " & typ)

Also : Private prequa As String it should be : Private prequa As Double total = quan * prequa --> You can't multiply Double with String. it must same type.

EkoX commented: Great +1
Jade_me commented: Great +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

I try changing it prequa = True to prequa = 13.08 but it didn't work so what can you do?

You can't. prequa type is Boolean (True or False). Prequa can't accept another value except true or false.
Make new variable as a Double or change the type of prequa from Boolean to Double.

Sawamura commented: Helpfull as always.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Okay. Line 21 : Console.Write(name("Do you want premium y/n")) It should be Console.Write(name + " Do you want premium y/n")

Jx_Man 987 Nearly a Senior Poster Featured Poster

Seems He/she already solved it,a few minutes after this thread posted:)

Vega_Knight commented: :p +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

>> Is it possible to have the menu and header static and loads each form in one dynamic container.
Yes. You can make parent-child form.
Say Form1 as the container/parent and form2 as child.
Set IsMdiContainer in Form1 Properties as True.
In menu event :

Dim a As New Form2
 a.MdiParent = Me
 a.Show()
Hawk123 commented: cool +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Dim StartPos, Counter As Integer
    Dim FindString, ReplaceText As String
    FindString = "test"
    ReplaceText = "MyString"
     
    For Counter = 1 To Len(Text1.Text)
            StartPos = InStr(Text1.Text, FindString)
            If StartPos > 0 Then
                    Text1.SelStart = StartPos - 1
                    Text1.SelLength = Len(FindString)
                    Text1.SelText = "" + ReplaceText
            End If
    Next
november_pooh commented: Yes. This code very helpful. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome

Neji commented: Nice +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

You can use SysInfo Component to get information about battery status.
Project->Component->Microsoft SysInfo Control
Add it to Form and use this following codes :

Private Sub Form_Load()
    List1.AddItem "BatteryFullTime = " & _
    Format$(SysInfo1.BatteryFullTime)
    List1.AddItem "BatteryLifeTime = " & _
    Format$(SysInfo1.BatteryLifeTime)
    List1.AddItem "BatteryLifePercent = " & _
    Format$(SysInfo1.BatteryLifePercent / 100, _
    "Percent")
    Select Case SysInfo1.BatteryStatus
    Case 1
    List1.AddItem "BatteryStatus = HIGH"
    Case 2
    List1.AddItem "BatteryStatus = LOW"
    Case 4
    List1.AddItem "BatteryStatus = CRITICAL"
    Case 128
    List1.AddItem "BatteryStatus = NO BATTERY"
    Case 255
    List1.AddItem "BatteryStatus = UNKNOWN"
    End Select
End Sub
debasisdas commented: really appreceate that. +13
Sawamura commented: Thank you sir. This code working so well. I really appreciated this +3
Estella commented: I appreciated it too :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome. :)

Vega_Knight commented: Very helpful person +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Option Explicit

#If Win32 Then
    Private Const LB_FINDSTRING = &H18F
    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

#Else

    Private Const WM_USER = &H400
    Private Const LB_FINDSTRING = (WM_USER + 16)
    Private Declare Function SendMessage Lib _
                    "User" (ByVal hWnd As Integer, ByVal _
                    wMsg As Integer, ByVal wParam As _
                    Integer, lParam As Any) As Long
#End If

Private Sub Form_Load()
    List1.AddItem "Orange"
    List1.AddItem "Banana"
    List1.AddItem "Apple"
    List1.AddItem "Pear"
End Sub

Private Sub Text1_Change()
    Dim pos As Long
    List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text))

    If List1.ListIndex = -1 Then
        pos = Text1.SelStart
    Else
        pos = Text1.SelStart
        Text1.Text = List1
        Text1.SelStart = pos
        Text1.SelLength = Len(Text1.Text) - pos
    End If

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    On Error Resume Next
    If KeyCode = 8 Then 'Backspace
        If Text1.SelLength <> 0 Then
            Text1.Text = Mid$(Text1, 1, Text1.SelStart - 1)
            KeyCode = 0
        End If
    ElseIf KeyCode = 46 Then 'Del
        If Text1.SelLength <> 0 And _
            Text1.SelStart <> 0 Then
            Text1.Text = ""
            KeyCode = 0
        End If
    End If
End Sub
ITKnight commented: Thank you Jx_man for wonderful codes +2
makiprabakaran commented: sir onr dought me. when i wrongly selected do backspace bar buuton tottaly erase.i want erase one by one backspace +0
Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't understand what the relevance about your question and your posting code, but i still to answer it.

If you want to close all form and end the program then you can use END .
Unload Me just close the current form not the entire program. So any hidden form can still running.

Private Sub Command1_Click()
Unload Me
End Sub

When you use End Statement it will close all entire form, Hidden or not hidden. so any process will turning off.

Private Sub Command2_Click()
End
End Sub
Sawamura commented: I think.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim i As Integer
If ListView1.SelectedItems.Count = 0 Then Exit Sub 
i = Val(ListView1.SelectedIndices.Item(0).ToString)
MsgBox(ListView1.Items(i).SubItems(1).Text)
End Sub

You also can use this line of code to get selected index :

i = Val(ListView1.SelectedItems(0).Index)
'and this
i = ListView1.SelectedIndices(0)
dnk commented: Your helping make this thread solved after 2 years :D +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Good. I Really appreciate when you make some effort.
You made mistake when put "next i". You just need to update the recordset.
You don't have to update data field of datareport. When you assign DataReport source with Recordset it will accommodate all data of listview on recordset.
So, it should be like this :

Dim RsTest As Recordset
Dim i As Integer
Set RsTest = New ADODB.Recordset
 
With RsTest.Fields
.Append "Field1", adDouble
.Append "Field2", adBSTR
.Append "Field3", adInteger
End With
 
RsTest.Open

For i = 1 To MyList.ListItems.Count
    With rsTest
        .AddNew
        .Fields("Field1") = MyList.ListItems(i).Text
        .Fields("Field2") = MyList.ListItems(i).SubItems(1)
        .Fields("Field3") = MyList.ListItems(i).SubItems(2)
        .Update
    End With
Next i ' Put here

Set DataReport1.DataSource = RsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
End With

DataReport1.Refresh
DataReport1.Show 1
Jx_Man 987 Nearly a Senior Poster Featured Poster

But i dont want to use any database.

Did u read this code correctly?
This code didn't use any database.
Are you trying this code?

My problem is to transfer data of Listview and textboxs (list on any form of VB6 Application ) directly to Database.

I already give you this sample code, now your turn to modified it with listview items data.

Please help me as soon as possible.

Do not expect this. You not pay me to get this code.

november_pooh commented: He the lazy one..don't get mad for him. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See If This Helps :

An example of writing a file:
Dim sFileText as String
Dim iFileNo as Integer
iFileNo = FreeFile
'open the file for writing
Open "D:\Test.txt" For Output As #iFileNo
'please note, if this file already exists it will be overwritten!

'write some example text to the file
Print #iFileNo, "first line of text"
Print #iFileNo, " second line of text"
Print #iFileNo, "" 'blank line
Print #iFileNo, "some more text!"

'close the file (if you dont do this, you wont be able to open it again!)
Close #iFileNo
Sturdy commented: Really a Vig Help +1
Estella commented: Nice :D +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See this thread

Jx_Man 987 Nearly a Senior Poster Featured Poster

This an example :
Modified as u needed.

Set rsTest = New ADODB.Recordset

With rsTest.Fields
.Append "Field1", adBSTR
.Append "Field2", adBSTR
.Append "Field3", adBSTR
End With

rsTest.Open

With rsTest
.AddNew
.Fields("Field1") = "Test1"
.Fields("Field2") = "Test2"
.Fields("Field3") = "Test3"
.Update
End With
Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
End With
DataReport1.Refresh
DataReport1.Show 1
End Sub
dnk commented: Great Code +2
ITKnight commented: I even never think about this way..it's awesome dude. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster
if (count<max) and (br.checked=true or am.checked=true) then
'code
end if

Yes, you can do this.

ninjatalon commented: thanks +2
Jx_Man 987 Nearly a Senior Poster Featured Poster
dnk commented: Surely great site finding.. +2
Naruse commented: Good reference +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome.
Happy Coding

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :
Text1 is filled by any text or words
Text2 is filled by char to find.

Private Sub Command1_Click()
    Dim CharCount, i As Integer
    CharCount = 0
    For i = 0 To Len(Text1.Text)
        Text1.SetFocus
        Text1.SelStart = i
        Text1.SelLength = 1
        If Text1.SelText = Text2.Text Then 
            CharCount = CharCount + 1 sesuai
        End If
    Next
    MsgBox "You have " & CharCount & " Character " & Text2.Text
End Sub
dnk commented: Good job +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :
Assuming that the ListView already have a header, so index i start from 1.
If you don't have header then index start from 0.

Private Sub Command1_Click()
Dim temp As Integer
temp = 0
For i = 1 To ListView1.ListItems.Count
    'temp = temp + Val(ListView1.ListItems.Item(i).Text) ' First Column
    temp = temp + Val(ListView1.ListItems(i).SubItems(1)) ' Second Column 
    'temp = temp + Val(ListView1.ListItems(i).SubItems(2)) ' Third Column
Next i
MsgBox temp
End Sub
Jade_me commented: Thank You for always helping..i hope you can help me on another thread.. :D +2
november_pooh commented: Great help :) +3
Vega_Knight commented: Very helping person +2
Sawamura commented: Good. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Change combo box Event from Combo1_Change() to Combo1_Click() :

Private Sub Combo1_Click()
Select Case Me.Combo1
    Case "bob"
        Me.Combo2.Enabled = True
    Case "carol"
        Me.Combo2.Enabled = True
    Case "jeff"
        Me.Combo2.Enabled = False
    Case "freeda"
        Me.Combo2.Enabled = False
    Case Else ' this for case else
        Me.Combo2.Enabled = False
End Select
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Change this line (at line # 8):

t = Mid(msg, i, Len(msg))

With this :

t = Mid(msg, i, Len(msg)) + Left(msg, i)

Hope it helps :)

dnk commented: Really helpfull person. +2
Neji commented: Good eyes for this.. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

You mean system directory?

See if this helps :

Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
    Dim sSave As String, Ret As Long
    sSave = Space(255)
    Ret = GetSystemDirectory(sSave, 255)
    sSave = Left$(sSave, Ret)
    MsgBox "Windows System directory: " + sSave
End Sub
Vega_Knight commented: Perfect +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Why not use StrConv()

See if this helps :

Private Sub txtQuote_Change()
  txtQuote.Text = StrConv(txtQuote.Text, vbProperCase)
  txtQuote.SelStart = Len(txtQuote.Text)
End Sub
dnk commented: Very Quckly Response +2
Jade_me commented: :D +2
Naruse commented: Agree +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

This following code to get data from datagrid..

DataGrid1.Row = 0 ' first row.. just looping as many of datagrid rows 
DataGrid1.Columns(0).Value
DataGrid1.Columns(1).Value
DataGrid1.Columns(2).Value
Jx_Man 987 Nearly a Senior Poster Featured Poster
MsgBox temp(0) + vbCrLf + temp(1) + vbCrLf + temp(2) + vbCrLf + temp(3)

You accessing array with this way..
How about if you have many words separated with commas?
Are you want to get all data by write it one by one?
Use looping and Ubound to get last index of array

Private Sub Command1_Click()
Dim temp As Variant
Dim str As String
Dim arr As String
str = "i,love,you,forever"
temp = Split(str, ",")

For i = 0 To UBound(temp) ' get the last index with Ubound
    arr = arr + temp(i) + vbCrLf ' Read data until last index and store it on arr
Next i
MsgBox arr ' display it on message box
End Sub
Naruse commented: You enlighten me so much sir..Thank you :) +3
dnk commented: good point. +2
november_pooh commented: Good Point here.. :D +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Dim i, Count As Integer

Count = 0

i = InStr(i + 1, Text1.Text, "How")
If i = 0 Then
    MsgBox 0
    Exit Sub
End If

Do While i > 0
    i = InStr(i + 1, Text1.Text, "How")
    Count = Count + 1
Loop

MsgBox Count
dnk commented: Thanks +2
ITKnight commented: Nice code +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use Mid function to search space in text box:

Private Sub Command1_Click()
Dim Counts As Integer
If Text1.Text = "" Then
    Counts = 0
Else
    Counts = 1
    For i = 1 To Len(Text1.Text)
        If Mid(Text1.Text, i, 1) = " " Then ' use Mid to search space
            Counts = Counts + 1
        End If
    Next
End If
MsgBox Counts
End Sub
WaltP commented: Why do you insist on doing their homework? -3
dnk commented: Thanks for Mid function +2
november_pooh commented: Usefull +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

If you have array textboxes then you can use looping to clear text box :

Dim i as Integer
For i = 0 to 10
    txt(i).Text = ""
Next

Or you can check if the type of control is text box then clear the control text.

For Each txt In Form1.Controls
    If TypeOf txt Is TextBox Then txt.Text = ""
Next
Sturdy commented: Really Great :) +1
debasisdas commented: agree +12
november_pooh commented: Helping +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long
Dim RetVal As Long
Private Sub Command1_Click()
Dim y As Integer
   y = MsgBox("Are u sure to delete all items on Recycle Bin ? ", vbYesNo, "Confirmation")
   If y = vbYes Then
      RetVal = SHEmptyRecycleBin(0&, vbNullString, &H1)
   MsgBox "Recycle Bin has been cleaned"
   End If
End Sub
Naruse commented: Its Worked :) +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub Timer1_Timer()
TCount = TCount - 1

Label1.Caption = TCount  
If TCount = 0 Then
  Msgbox "Time's UP!"
End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
ITKnight commented: Complete Guide +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

There are many way to accomplish this.
See if this help :

' Get a free file number
nFileNum = FreeFile

' Open a text file for input. inputbox returns the path to read the file
Open "D:\test.txt" For Input As nFileNum
lLineCount = 1
' Read the contents of the file
Do While Not EOF(nFileNum)
   Line Input #nFileNum, sNextLine
   'do something with it
   'add line numbers to it, in this case!
   sNextLine = sNextLine & vbCrLf
   sText = sText & sNextLine

Loop
Text1.Text = sText
' Close the file
Close nFileNum
november_pooh commented: Really Quick Solution.. thx jx +3
Vega_Knight commented: This a good stuf :) +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

as debasisdas said, use common dialog control

First you need to add the component:
* Project > Components
* On the Controls tab, choose Microsoft Common Dialog Control 6.0 (SP6)

Now on your form, add the new Common Dialog control from the toolbox

this following code to use common dialog :

Private Sub btnBrowse_Click()
    CommonDialog1.Filter = "All files (*.*)|*.*"
    CommonDialog1.DialogTitle = "Select File"
    CommonDialog1.ShowOpen
    
    MsgBox CommonDialog1.FileName
End Sub
Sturdy commented: Thank you.. +1