Jx_Man 987 Nearly a Senior Poster Featured Poster

using timer.
in timer event you can change text color.

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

i think its textbox

Jx_Man 987 Nearly a Senior Poster Featured Poster

just put your code in function method.
this an example :

Public Function GetSpecialFolder(ByVal mFolder As Environment.SpecialFolder) As String
        GetSpecialFolder = Environment.GetFolderPath(mFolder)
End Function

Private Sub Form1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.Text = GetSpecialFolder(Environment.SpecialFolder.System)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Well, great..
Don't forget to mark this thread solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> filelength = filelength + file.Length
it should be objfile.length

>> filelength = filelength + file.Length
why you add filelength with file.Length?
just filelength = file.length

i suggest to make a function, so it looks neat.

Imports System.IO
...
Private Function GetFileSize(ByVal MyFilePath As String) As Long
        Dim MyFile As New FileInfo(MyFilePath)
        Dim FileSize As Long = MyFile.Length
        Return FileSize
    End Function

to call this function :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim temp As String
        temp = GetFileSize("D:\Address.txt") / 1000

        MsgBox(temp)
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome friend...
Don't forget to mark this thread Solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

ok.
so this thread was solved or not?

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmmm, how far u have done?show the code and other member can correct any mistaken..

Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    Form1.ActiveForm.Opacity = TrackBar1.Value / TrackBar1.Maximum
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code :

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        If Val(TextBox3.Text) > 32 Then
            TextBox3.Text = TextBox3.Text.Remove(0, Len(TextBox3.Text))
            MsgBox("input under 33")
        End If
    End Sub
jaytheguru commented: Just Superb! +1
dnk commented: cool :) +1
Jade_me commented: Great simple code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

To call form2 you must to make an object of form2 :

Dim MainMenu as New Form2
MainMenu.show

To close form1 after called form2 :
- Don't use Me.Close cause it will close application.
- Use Dispose(), set it to false.
e.g :

Dim MainMenu as New Form2
MainMenu.show
Me.Dispose(False)
debasisdas commented: great, this is No 1 hit in google search. +13
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code :
First Textboxt to input words = textbox2
Second to input certain char = textbox1
Button to execute and label to show result.

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim jmlText, jmlChar, i As Integer
        jmlChar = 0 
        jmlText = Len(TextBox2.Text) 
        For i = 0 To jmlText 
            TextBox2.Focus()
            TextBox2.SelectionStart = i
            TextBox2.SelectionLength = 1
            If TextBox2.SelectedText = TextBox1.Text Then  
                jmlChar = jmlChar + 1 '
            End If
        Next
        Label1.Text = "You have " & jmlChar & " Character " & TextBox1.Text
End Sub
november_pooh commented: wow.... +1
Sawamura commented: really a nice code. +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
' Return True if a file exists

Function FileExists(FileName As String) As Boolean
    On Error GoTo ErrorHandler
    ' get the attributes and ensure that it isn't a directory
    FileExists = (GetAttr(FileName) And vbDirectory) = 0
ErrorHandler:
    ' if an error occurs, this function returns False
End Function

Private Sub Form_Load()
If FileExists("H:\settings.txt") = True Then
    MsgBox "Your Code If File exists"
Else
    MsgBox "Your Code if File not found"
End If
End Sub
Sawamura commented: really nice +1
Neji commented: Great code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

see this code :

Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\MyDB.mdb;")
cn.Open()
cmd = New OleDbCommand("SELECT * FROM Breakdown WHERE BFrom = '" & txtFrom.Text & "'", cn)
dr = cmd.ExecuteReader
If dr.Read()
  MsgBox "Matching Records Found"
  'write whatevr code u want here
Else
  MsgBox "Data not found"
End If
dr.Close()
cn.Close()
Estella commented: helping suggestion +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi...
You want to add it and run with vb.net.
.Net doesn't have a special Script Control.
Download the Script Control (ActiveX) from Microsoft
See this link

ITKnight commented: thankss....it very helpful +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

I hope that will solved your problem.

Neji commented: yes...it was solved. thank you for great link +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

First add reference Microsoft SQLDMO Object Library.
then add this code :

Dim i As Integer
        Dim oNames As SQLDMO.NameList
        Dim oSQLApp As SQLDMO.Application
        oSQLApp = New SQLDMO.Application
        oNames = oSQLApp.ListAvailableSQLServers()
        AddHandler ComboBoxEdit4.SelectedIndexChanged, AddressOf comboBoxEdit4_SelectedIndexChanged

        For i = 1 To oNames.Count
            Me.ComboBoxEdit4.Properties.Items.Add(oNames.Item(i))

        Next i
Jade_me commented: thanks it was solved my program +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :

Public Function Factorial(ByVal Number As Integer) As String
        Try
            If Number = 0 Then
                Return 1
            Else
                Return Number * Factorial(Number - 1)
            End If
        Catch ex As Exception
            Return ex.Message
        End Try
    End Function

I called this function in button click event:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
       Dim num As Integer
        num = Val(InputBox("Enter the Factorial Number"))
        MsgBox(Factorial(num))
End Sub
Sawamura commented: Well great +1
Vega_Knight commented: thank you very much for your help +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

lstdateandtime.Sorted = True

Jx_Man 987 Nearly a Senior Poster Featured Poster

this will detect if mouse button clicked :

Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        If e.Button = MouseButtons.Left Then
            MsgBox("left button clicked")
        ElseIf e.Button = MouseButtons.Right Then
            MsgBox("Right button clicked")
        End If
    End Sub
Naruse commented: thx..i didn't know how easy it is +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hmm..
when u opened vb 6 project use vb.net it will convert your project in vb.net. so u can convert your project into vb 6 first then u can open current project in vb.net.
Thats what i doing.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Well, try this code :
add this code in datagrid click event.

Dim i As Integer
i = dgAuthor.CurrentRowIndex()
MsgBox(Trim(dgAuthor.Item(i, 0)) & " - " & Trim(dgAuthor.Item(i, 1)) & " - " & Trim(dgAuthor.Item(i, 2)))

Modified as u needed.

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

you mean get data on each row?

Jx_Man 987 Nearly a Senior Poster Featured Poster

just to correct :)
Dim LengthOfTID as Integer
Anyway selvaganapathy has given the best answer.

november_pooh commented: :) +1
Estella commented: hmmm +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

which one u want to use?
Horizontal scroll bar

Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub

Vertical scroll bar

Private Sub VScroll1_Change()
Text1.Text = VScroll1.Value
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

the easiest way is copying current access database to backup folder.
Use FileCopy to copying file.
this following code is an example :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        FileCopy("D:\Authors.mdb", "D:\BackUpFolder\NewBackUpName.mdb")
End Sub

So file Authors.mdb in D:\ will copying into Folder BackUpFolder

Estella commented: Nice way :) +1
dnk commented: good idea +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome.
don't forget to mark this thread solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

just copying a .mdb file to backup folder.

november_pooh commented: Right +1
Sawamura commented: Nice +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i think its not twice but all formats of date-time. short or long formats, country formats..
why don't use datetime picker?

ListBox1.Items.Add(DateTimePicker1.Value.Now)
Jx_Man 987 Nearly a Senior Poster Featured Poster
label1.Text = dateTimePicker1.Value.ToShortDateString();
Jx_Man 987 Nearly a Senior Poster Featured Poster

initial condition

Dim i As Integer
i = dgUser.CurrentRowIndex()

i.e : (this following code will select user where id user = value of first column from selected datagrid). Of course in datagrid click event :

Private Sub dgPendidikan_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgPendidikan.Click
...
cmdUser.CommandText = "SELECT * FROM Users where IdUser ='" & Trim(dgUser.Item(i, 0)) & "'"
....
end sub
Jade_me commented: Great +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

what the problem now?

Jx_Man 987 Nearly a Senior Poster Featured Poster

This following code just allowed you to entered numbers only (No alphabetics or any special characters) :

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    If (Microsoft.VisualBasic.Asc(e.KeyChar) < 48) _
              Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 57) Then
            e.Handled = True
    End If
    If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
            e.Handled = False
    End If
End Sub

This following code just allowed you to entered strings / alphabetics only (no numbers or any special characters):

Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        If (Microsoft.VisualBasic.Asc(e.KeyChar) < 65) _
            Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 90) _
            And (Microsoft.VisualBasic.Asc(e.KeyChar) < 97) _
            Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 122) Then
            'Allowed space
            If (Microsoft.VisualBasic.Asc(e.KeyChar) <> 32) Then
                e.Handled = True
            End If
        End If
        ' Allowed backspace
        If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
            e.Handled = False
        End If
End Sub
ITKnight commented: lets talk about powerfull code of you. great man +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Microsoft Chart Control 6.0 (SP4)

november_pooh commented: thank you +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Year.Text < Now.Year Then
            MsgBox("Cannot input past year")
        ElseIf Year.Text = Now.Year Then
            If Trim(Month.Text) < Now.Month Then
                MsgBox("Cannot input past month")
            End If
        End If
    End Sub
november_pooh commented: Helping me +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

If this question already solved please mark thread to Solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

what the problem is?show me your effort...
any error occured?

Jx_Man 987 Nearly a Senior Poster Featured Poster

yes, please give a feedback

Jx_Man 987 Nearly a Senior Poster Featured Poster

This following code will display a picture after progress bar is 100 %.

Dim i as Integer
	For i = ProgressBar1.Minimum To ProgressBar1.Maximum
		ProgressBar1.Value = x
	Label1.Text = x / 100 & "%"
	If i = ProgressBar1.Maximum Then
		PictureBox1.Image = Image.FromFile _
		("C:\Pic\Me.bmp")
	End If
	Next i
Naruse commented: This man alwasy helping +1
dnk commented: kasih daaah +1
Sawamura commented: Maturnuwun mas +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :

Private Sub Cut()
    If Me.Textbox1.Text.Length > 0 Then
        Clipboard.SetDataObject(Me.Textbox1.SelectedText)
        Me.Textbox1.Cut()
    End If
End Sub

Private Sub Copy()
    If Me.Textbox1.Text.Length > 0 Then
        Me.Textbox1.Copy()
    End If
End Sub

Private Sub Paste()
    If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
        Me.Textbox1.Paste()
    End If
End Sub
Estella commented: Worked Perfectly +1
dnk commented: Good +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this following code :

Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
    Editor.SelectionIndent = Editor.Width * (TrackBar1.Value / TrackBar1.Maximum)
End Sub
Sawamura commented: works perfect :) +1
Neji commented: speedy +1
november_pooh commented: never know this +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

so, what do you want?

Const PW = "nimda"
        Dim sInput As String

        sInput = InputBox("Enter Password to Open: ")

        If (sInput <> PW) Then
            Beep()
            MsgBox("Invalid password, cannot Open...")
        Else
            'code to delete record
        End If
ITKnight commented: Good +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

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

Jx_Man 987 Nearly a Senior Poster Featured Poster

Yes, i know it but your sintax is wrong, its should be C:\ not C:/
Also you don't have function to check if folder exist or not. see this following code :

Public Function FolderExist(Path As String) As Boolean

If LenB(Path) = 0 Then FolderExist = False: Exit Function

If LenB(Dir$(Path, vbDirectory)) > 0 Then
If (GetAttr(Path) And vbDirectory) = vbDirectory Then FolderExist = True
Else
FolderExist = False
End If
End Function

Private Sub Command1_Click()
Dim d, Path As String

d = Format(Now(), "dddd, yyyy mmmm dd")
MsgBox (d)

Path = "C:\Photos " & d
If FolderExist(Path) = True Then
    MsgBox "Folder is available"
Else
    rspCreate = MsgBox("Directory doesn't exist, do you wish to create it?", vbYesNo)
    If rspCreate = vbYes Then
        MkDir Path
    End If
End If
End Sub
dnk commented: Nice +1
november_pooh commented: Great +1
Naruse commented: Nice one friend :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

its not about date but your pathName is wrong.
should be : C:\

Jx_Man 987 Nearly a Senior Poster Featured Poster

:)

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code (needed timer and statusbar with 2 panels), text to scrolling is from StatusBar panel 2 text :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  Dim text As String
  text = StatusBar1.Panels.Item(0).Text
  StatusBar1.Panels.Item(0).Text = text.Substring(1) & text.Substring(0, 1)
End Sub

i post the screenshot too.

Neji commented: great +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

there is the file

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome my friend :)