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
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
number variable not increase.
alternative, you use WindowsMediaPlayer to play media file.
>> 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.
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
This some files to import :
Imports System.Data
Imports System.Data.SqlClient
what kind of error ??
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
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()
seems like antivirus program
yes i know it for c#...but you can get a logic from that.
That's i why still post it.
Good luck :)
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?
Great Code iamthwee :)
>> ListBox1.Items.Add(Prc(x).ProcessName)
thanks iamthwee for the correction.
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
You're Welcome :)
On Button Click Event :
Dim a As New Form2
a.Show
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
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
>> 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
what kind of error?
you're welcome.
Don't forget to mark this thread Solved if it already solved :)
you can see my snippet here and here
http://www.daniweb.com/code/snippet820.html
http://www.daniweb.com/code/snippet836.html
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.
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
first know the business flows.
Create database for it then make a program.
On Form Properties, Set FormBorderStyle = None.
It will make your form haven't border and not able to move.
You mean you want to find data where Fieldname = condition ?
And condition is user input?
Clear combobox and load data on combobox after saving.
listview can be alternate...
Good Luck with your thesis.
Don't Forget to mark this thread Solved
Happy coding friend :)
dim string1 as string
string1 = gridview1.rows(row#).cells(cell#).text.tostring
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
Thx for replying.I do it by own...
Please share your answer. It will help other members when they get same problem.
Thank you :)
not specify, explain more...
>>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
....
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...
>> 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.
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
which version u got problem?
like debasisdas said you can connect vb with any version of access.
Call Decript function before check. ......WHERE Decript(psw)=' " & text1.text & " '
Or
You can encript inputed pasw before check ......WHERE psw=' " & Encript(text1.text) & " '
Great. Don't forget to mark this thread as solved :)
yup, icon can be extract from dll or exe file. Just confirm from exe or dll file u want to extract icons. :)
Great code
well, its not table. its listview.
Component name is Microsoft Windows Common 6.0(sp6)
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
SS Tab is a control on Component (Ctrl + T or Project ->Component).
First you must to know the pattern of prime number then u can write the code.
see wikipedia and FactMonster
if successfully then give a message.
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