Jx_Man 987 Nearly a Senior Poster Featured Poster

1. Just add your msword file on your setup project.
then you can modified path of msword file :

System.Diagnostics.Process.Start(Application.StartupPath & "\MsWordFileName.doc")

2. On combox properties, set DropDownStyle = DropDownList

Jx_Man 987 Nearly a Senior Poster Featured Poster

number variable not increase.

Jx_Man 987 Nearly a Senior Poster Featured Poster

alternative, you use WindowsMediaPlayer to play media file.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> IS THIS CODE WORKING FOR U ???
Yes...Its working for me.

>> WHEN I INSERT A RECORD , THEN THE NUMBER IS NOT INCREMENTED TO NEXT RECORD
Call that procedure after inserting data

>> EVEN IF I LOAD MY FORM AGAIN I SHOULD GET TO SEE THE NEXT NUMBER BUT IT STARTS AGAIN FROM 1, THAT VIOLATES MY PRIMARY CONSTRAINT
Check your database. If your data was inserted then it should working.

And please don't use capital letters. I am trying to help you.

Jx_Man 987 Nearly a Senior Poster Featured Poster

getconnect() is Function to connect to sqlserver.
put this code in module. my module named Koneksi

'In Module
'Declare outside of class
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
Jx_Man 987 Nearly a Senior Poster Featured Poster

This some files to import :

Imports System.Data
Imports System.Data.SqlClient

what kind of error ??

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Public Sub GenerateNotaId()
        Dim myReader As SqlDataReader
        conn = GetConnect()
        conn.Open()
        Dim temp As String
        Try
            Dim sql As String = "SELECT MAX(IDNOTA) AS 'KODE' FROM Nota "
            Dim comm As SqlCommand = New SqlCommand(sql, conn)
            myReader = comm.ExecuteReader
            If myReader.HasRows Then
                While myReader.Read()
                    temp = myReader.Item("KODE") + 1
                End While
            End If
            myReader.Close()
        Catch ex As Exception

        End Try
        conn.Close()
        If temp = 0 Then
            txtNoNota.Text = 1
        Else
            txtNoNota.Text = String.Concat(temp)
        End If
End Sub

Generate will shown in txtNoNota

Estella commented: Siip, this what i looking for :P +1
ITKnight commented: Great Code +1
Naruse commented: not bad +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

This an example :

Dim conn As SqlConnection
    Dim cmdCustomer As New SqlCommand
    Dim daCustomer As New SqlDataAdapter
    Dim dsCustomer As New DataSet
    Dim dtCustomer As New DataTable

    conn = GetConnect()
    conn.Open()
    Try
        dsCustomer.Clear()
        dtCustomer.Clear()
        cmdCustomer = conn.CreateCommand
        cmdCustomer.CommandText = "SELECT * FROM Customer where IDCustomer = '" & Trim(txtIdCustomer) & "'"
        daCustomer.SelectCommand = cmdCustomer
        daCustomer.Fill(dsCustomer, "Customer")
        dtCustomer = dsCustomer.Tables("Customer")

        If (dtCustomer.Rows.Count > 0) Then
            txtNamaCustomer.Text = dtCustomer.Rows(0).Item(1)
	    cmdButton.enable = False
        Else
            MsgBox("Can't Find Id customer!!")
            txtPlatNo.Focus()
        End If

    Catch ex As Exception
        MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Connection Error !!")
    End Try
    conn.Close()
Jx_Man 987 Nearly a Senior Poster Featured Poster

seems like antivirus program

Jx_Man 987 Nearly a Senior Poster Featured Poster

yes i know it for c#...but you can get a logic from that.
That's i why still post it.
Good luck :)

november_pooh commented: Try to get logic from that site :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jade_me commented: this for c#??? +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub Timer1_Timer()
'Put timer on form and set interval to 1000 (In the properties window)

Label1.Caption = Format(Now, "hh:mm:ss")

End Sub

- What tabs?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Great Code iamthwee :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> ListBox1.Items.Add(Prc(x).ProcessName)

thanks iamthwee for the correction.

Sawamura commented: Great code :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

First, you need the following declarations:

Private Const EM_GETLINECOUNT As Integer = &HBA
    Private Const EM_GETLINE As Integer = &HC4
    Private Const EM_LINELENGTH As Integer = &HC1
    Private Const EM_LINEINDEX As Integer = &HBB

    Private Declare Function SendMessageINT Lib "user32.dll" _
        Alias "SendMessageA" (ByVal hWnd As IntPtr, _
        ByVal wMsg As Integer, ByVal wParam As Integer, _
        ByVal lParam As IntPtr) As Integer

Now, I placed this code in a button click event :
Counter set = 1 to start from second line.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim LineCount As Integer = SendMessageINT(TextBox1.Handle, EM_GETLINECOUNT, 0, IntPtr.Zero)
        Dim counter As Integer = 0
        Dim LineIndex As Integer = 0
        Dim lineLength As Integer
        Dim curLine As String = ""
        Dim stringPTR As IntPtr

        For counter = 1 To LineCount - 1
            'Get Index for line we want to retrieve
            LineIndex = SendMessageINT(TextBox1.Handle, EM_LINEINDEX, counter, IntPtr.Zero)
            'GetLineLength
            lineLength = SendMessageINT(TextBox1.Handle, EM_LINELENGTH, LineIndex, IntPtr.Zero)
            'Create the buffer
            curLine = New String("0"c, lineLength + 2)
            Mid(curLine, 1, 1) = Chr(lineLength And &HFF)
            Mid(curLine, 2, 1) = Chr(lineLength \ &H100)
            'Get the pointer for a buffer
            stringPTR = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(curLine)
            'Fill the pointer with the current line
            SendMessageINT(TextBox1.Handle, EM_GETLINE, counter, stringPTR)
            'Read the line
            curLine = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(stringPTR)
            curLine = curLine.Substring(0, lineLength)
            'fill textbox2
            TextBox2.Text = TextBox2.Text + curLine + vbCrLf
            'clear out the space
            System.Runtime.InteropServices.Marshal.FreeHGlobal(stringPTR)
            stringPTR = IntPtr.Zero
        Next

    End Sub

See the pic

Estella commented: awesome.... :D +1
Neji commented: So hard....:twisted: +1
Jade_me commented: :confused: +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome :)

Jx_Man 987 Nearly a Senior Poster Featured Poster
On Button Click Event :
Dim a As New Form2
a.Show
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

        CrystalReportViewer1.SelectionFormula = "Date({TableName.FieldName}) >= #" & dtStartDate.Value & "# And Date({TableName.FieldName}) <= #" & dtEndDate.Value & "#"
        CrystalReportViewer1.RefreshReport()

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub ProcessView()
        Dim Prc As Process()
        Dim x As Integer

        Prc = Process.GetProcesses

        For x = 0 To UBound(Prc)
            ListBox1.Items.Add(Prc.GetValue(x))
        Next
End Sub
Sawamura commented: Great code +1
Jade_me commented: Good :P +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

>> process of creating
- Add new Item -> Module -> OK
- Just put code that u want to access from any form.
>> using module..
- call function or procedure or anything you have declare in your module

Jx_Man 987 Nearly a Senior Poster Featured Poster

what kind of error?

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome.
Don't forget to mark this thread Solved if it already solved :)

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

Its hard to make a shop program for beginner.

first try to save, edit and delete database.
just make a simple program like phone book.
First make database :
Table field (IdPhoneBook, FirstName, LastName, Address, PhoneNumber)
Then make a code to save, edit and delete data phone book to database.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Add component Microsoft Common Dialog Control 6.0 (SP6).
To open File and show it into picture box:

Private Sub btnBrowse_Click()
CommonDialog1.ShowOpen
txtPath.Text = CommonDialog1.FileName
Picture1.Picture = LoadPicture(txtPath.Text)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

first know the business flows.
Create database for it then make a program.

Jx_Man 987 Nearly a Senior Poster Featured Poster

On Form Properties, Set FormBorderStyle = None.
It will make your form haven't border and not able to move.

Jx_Man 987 Nearly a Senior Poster Featured Poster

You mean you want to find data where Fieldname = condition ?
And condition is user input?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Clear combobox and load data on combobox after saving.

Jx_Man 987 Nearly a Senior Poster Featured Poster

listview can be alternate...

Jx_Man 987 Nearly a Senior Poster Featured Poster

Good Luck with your thesis.
Don't Forget to mark this thread Solved

Happy coding friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster
dim string1 as string

string1 = gridview1.rows(row#).cells(cell#).text.tostring
Vega_Knight commented: thanks...its worked to me +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

this line not working : IO.File.Open(filePath, FileMode.Open) Try to change with Process Function :

If DialogResult.Yes Then
         Process.Start(filePath)
ElseIf DialogResult.No Then
         MsgBox("you decided not to open")
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

Thx for replying.I do it by own...

Please share your answer. It will help other members when they get same problem.
Thank you :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

not specify, explain more...

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>There are another ways to hide drive without using API function?
Yes, with add key on your registry...
Add module :

Public Sub CreateKey(ayun As String, Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite ayun, Value
End Sub

Public Sub CreateIntegerKey(ayun As String, Value As Integer)
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite ayun, Value, "REG_DWORD"

End Sub
'Delete registry key
Public Sub DeleteKey(Value As String)
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub

This following code will hide drive D:\

Private Sub Command1_Click()
CreateIntegerKey "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Nodrives", 8
End Sub

Restart or logoff to know it works or not
This is value of key :
C = 4
D = 8
E = 16
F = 32
...
C and D = 4 + 8 = 12
C and E = 4 + 16 = 20
D and E = 8 + 16 = 24
....
C and D and E = 4 + 8 + 16 = 28
....

Sawamura commented: Really Great code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Depend on your project...
if u needed to handle large database i suggest to use SQLServer...
but if u didn't use large database on your thesis (just for simple database), do it with MsAccess.
Its from me...

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> Is access is "beginner" friendly?
Yes, i think.
Access is easiest more than other database.
there are sqlserver, oracle, mysql, etc. but access is the easiest one.

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code to hide folder

Private Sub Form_Load()
Dim FileSys, FolderPath
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set FolderPath = FileSys.GetFolder("D:\test")
FolderPath.Attributes = -1
End Sub

to unhide set attributes = 0

Estella commented: Wonderful code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

which version u got problem?
like debasisdas said you can connect vb with any version of access.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Call Decript function before check. ......WHERE Decript(psw)=' " & text1.text & " ' Or
You can encript inputed pasw before check ......WHERE psw=' " & Encript(text1.text) & " '

Jx_Man 987 Nearly a Senior Poster Featured Poster

Great. Don't forget to mark this thread as solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

yup, icon can be extract from dll or exe file. Just confirm from exe or dll file u want to extract icons. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

Great code

Jx_Man 987 Nearly a Senior Poster Featured Poster

well, its not table. its listview.
Component name is Microsoft Windows Common 6.0(sp6)

Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub ListView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
        Dim i As Integer
        Dim lvitem As ListViewItem
        For i = 1 To 5
            lvitem = ListView1.Items.Add("1")
            lvitem.SubItems.Add("sonia")
            lvitem.Checked = True
        Next 
End Sub
dnk commented: worked +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

SS Tab is a control on Component (Ctrl + T or Project ->Component).

dnk commented: pleasee details +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

First you must to know the pattern of prime number then u can write the code.
see wikipedia and FactMonster

Vega_Knight commented: linkers +1
Naruse commented: N/A +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

if successfully then give a message.

Jx_Man 987 Nearly a Senior Poster Featured Poster

see this code, this my code to get data into combobox :

Private Sub BacaData()
        Dim i, k As Integer
        Dim cmdStudent As New SqlCommand
        Dim daStudent As New SqlDataAdapter
        Dim dsStudent As New DataSet
        Dim dtStudent As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdStudent = conn.CreateCommand
            cmdStudent.CommandText = "SELECT * FROM Student"
            daStudent.SelectCommand = cmdStudent
            daStudent.Fill(dsStudent, "Student")
            dtStudent = dsStudent.Tables("Student")
            For i = 0 To dtStudent.Rows.Count - 1
                cmbNis.Items.Add(dtStudent.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Connection Error !!")
        End Try
        conn.Close()
    End Sub
ITKnight commented: nice snippet +1
dnk commented: thanks +1