|
Let me simplify that a little bit... Your Settings form should deal with just that, changing the settings. It shouldn't have anything to do with restarting your application.
Your Main Form should launch the Settings Form as a Dialog (.ShowDialog). When the Settings Form is done saving any changes, it should set a flag exposed as Public in the Settings Form. When closed, control will return back to the Main Form immediately after the .ShowDialog statement. This is where you check that public property on the Settings Form (it's been closed, not removed from memory!) to see if you should restart your application or not. This is where you can launch another copy of your application and quit the current one.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to print the current form or a particular file by browsing the window simply by clicking on the button
|
|
|
|
|
You'r going to have to supply ALOT more detail than this. Printing the current form is no big deal, but what's with the "particular file by browsing the window simply by clicking on the button"? What are you talking about here.
Code: Printing a Windows Form (Visual Basic)[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Also you're going to have to let us know what version of VB you are using, for 6.0 printing the form is really simple (Me.printform), but in VB NET 2003 it's much more complicated. I had to do a project for a class that printed the form in 2003, utter chaos. I'll post the source later.
Treacherous_1
Here's what I came up with, it enables print preview, page setup, and printing in .NET 2003:
_________________________ Printing Form _____________________________
Imports System.Drawing.Printing
Public Class frmMain
Inherits System.Windows.Forms.Form
' storage for form image
Dim formImage As Bitmap
' create API prototype
Private Declare Function BitBlt Lib "gdi32.dll" Alias "BitBlt" (ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Long
#Region " Windows Form Designer generated code "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.StartPosition = FormStartPosition.WindowsDefaultLocation
End Sub
Private Sub mnuFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.Click
GetFormImage() 'Takes the screen shot to be printed
If pdbMgrReport.ShowDialog = DialogResult.OK Then
docMgrReport.Print()
End If
End Sub
Private Sub mnuFilePreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePreview.Click
GetFormImage() 'Takes the screen shot to be previewed
Try
ppdMgrReport.ShowDialog()
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End Sub
Private Sub mnuFileSetup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileSetup.Click
With psdMgrReport
docMgrReport.DefaultPageSettings.Margins.Left = 0.5
docMgrReport.DefaultPageSettings.Margins.Top = 0.5
docMgrReport.DefaultPageSettings.Landscape = True
.PageSettings = docMgrReport.DefaultPageSettings
End With
Try
If psdMgrReport.ShowDialog = DialogResult.OK Then
docMgrReport.DefaultPageSettings = psdMgrReport.PageSettings
End If
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End Sub
Private Sub mnuFileControl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileControl.Click
nextForm = "frmPreview"
End Sub
Private Sub mnuFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileExit.Click
nextForm = "Exit"
Me.Close()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) _
Handles docMgrReport.PrintPage
e.Graphics.DrawImage(formImage, 50, 50)
End Sub
Private Sub GetFormImage()
Dim g As Graphics = Me.CreateGraphics()
Dim s As Size = Me.Size
formImage = New Bitmap(s.Width, s.Height, g)
Dim mg As Graphics = Graphics.FromImage(formImage)
Dim dc1 As IntPtr = g.GetHdc
Dim dc2 As IntPtr = mg.GetHdc
' added code to compute and capture the form
' title bar and borders
Dim widthDiff As Integer = _
(Me.Width - Me.ClientRectangle.Width)
Dim heightDiff As Integer = _
(Me.Height - Me.ClientRectangle.Height)
Dim borderSize As Integer = widthDiff \ 2
Dim heightTitleBar As Integer = heightDiff - borderSize
BitBlt(dc2, 0, 0, _
Me.ClientRectangle.Width + widthDiff, _
Me.ClientRectangle.Height + heightDiff, dc1, _
0 - borderSize, 0 - heightTitleBar, 13369376)
g.ReleaseHdc(dc1)
mg.ReleaseHdc(dc2)
End Sub
End Class
_________________________ Print Preview ________________________________
Public Class frmPreview
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub ppcMgrReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ppcMgrReport.Click
Try
ppcMgrReport.Document = docMgrReport
Catch es As Exception
MessageBox.Show(es.Message)
End Try
End Sub
End Class
__________________________ Global Variables ____________________________
Module GlobalVariables
Public nextForm As String 'Which form should be displayed next?
Friend WithEvents docMgrReport As System.Drawing.Printing.PrintDocument
Public Sub main()
Dim frmCurrentForm As Form
frmCurrentForm = New frmMain
Do While nextForm <> "Exit"
Select Case nextForm
Case "Preview" : frmCurrentForm = New frmPreview
End Select
frmCurrentForm.ShowDialog()
Loop
End Sub
End Module
|
|
|
|
|
Hi there,
Actually,i'm designing a IQ test program that include a lot of pictures to be display all together at the same time.And it has a option button to select the answer for each question. At the end,I can calculate the result. After i finish the a question, then i can easily go to the next question just by scrolling. So, i need a form big enough to fit all the pictures.
I wonder if VB isn't the right software to use?Or i need to change to other programming language. Thank you, I'm really grateful if you can help me and thanks again.
|
|
|
|
|
VB Means VB6 or VB.Net . if vb.net then enable the scroll bar option in the form property and design your form as big as you want...
|
|
|
|
|
OOO...what is the different between VB6 and VB.NET. Can vb.net complie to an execute file(.exe)?
|
|
|
|
|
Of course it can! Well, all the .NET Framework managed code languages actually compiled to MSIL. When you double click the .EXE, the .NET Framework takes that and translates the MSIL into processor specific instructions on-the-fly.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have found that Win32_ServerSession in WMI returns the details of users that have connected to a network share. This is exactly the information that I am after, except that Win32_ServerSession doesn't work with Windows 2000.
Are there any API calls, registry locations, or older WMI providers that may supply this information on Windows 2000 machines?
Thanks in advance,
Paul T.
|
|
|
|
|
i want to find all the name of the registry key present in the specifice key
suppose i have a folder(key) in the registry at HKEY_LOCAL_MACHINE/SOFTWARE/MAINKEY
if there are five more folder in the in miankey
subkey1.....subkey5
i would like to have solution in vb6
|
|
|
|
|
The solution is MUCH too long to post here. You'd have a better chance at looking at some existing examples, or maybe using an existing module. Google for "VB6 Registry" and you'll come up with tons of examples. Google Results[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have 2 windows form . both for startup based on some condition but i donno how to change startup form at run time. I just know that the form which has sub Main method can be used as startup only .
plz guide me in this regard .
|
|
|
|
|
Have you tried adding a Module to your code?
Then you can shift the "Sub Main" code into the module, evaluate the condition, then launch the appropriate form.
Regards,
Paul T.
|
|
|
|
|
Omnipass is software that comes with the APC biopod fingerprint scanner. This program can differenciate between password fields and none. This carries over to most software programs and the web. I recently completed a program that requires you to login with a password and i would like to login with the Omnipass software. But the Software does not recognize my form as having a password field on it. I just want to see if anyone knows what i can do to make omnipass recognize my program. Thank you
|
|
|
|
|
Since we can't possibly know abou the tens of thousands of controls and libraries out there, you're best bet is to ask Softex.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I had a feeling that what would be said because thats what i would say. I was just hoping maybe someone has already crossed that bridge. Thank you
|
|
|
|
|
I've never heard of the product until you posted the question. Then it was a little matter of Googling. It looks like it's a pretty popular product for it's niche market. But that's your problem, it's a niche market product that doesn't have widespread use.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does anyone know how can i get my hand on avalon. I have heard a lot about avalon, but how can i start working on avalon.
|
|
|
|
|
Avalon is part of the next Windows release, codenamed Longhorn. You can find out about it here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi i have posted this message before also and got some help. now the the thing is i have got the interface from one of the manufacturer of medical equipment but i donot understand how to do it can anyone help.
|
|
|
|
|
monicatushar wrote:
i have got the interface from one of the manufacturer of medical equipment but i donot understand how to do it can anyone help.
Well, we know less about this medical equipment than you do.
What sort of interface? Do they provide an API? What does their documentation say about writing software for it? Do they give examples? Do they have their own support forum? (That last question may be your best route for an answer)
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
hello
how can i convert html file (containing images) to mht file from vb code?
thank you
|
|
|
|
|
Here is a datagridview on the winform, which connects to a dataconnector and a dataset.
Now if I edit the cell values and want to save the changes into the database.
How can I do?
Thanks!
|
|
|
|
|
I don't know if there's an 'automagic' way of doing it, but if you step through all the rows in the grid, you can check their properties to see which ones have been added or edited. From this, you can create database calls to update your database. I use SQL Server ( I notice most VB users seem to use Access ), and that means I can write stored procedures using OpenXML, which allows me to create an XML document that describes an arbitrary number of changes and/or new items, and then process them all in one database call. If you don't have that option, you can still build the SQL to perform the changes, just make sure either way that any text you pass in is cleaned to protect from injection attacks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sir,
i would like to ask whether is it the same in vb6,when there is shared function in vb.net such as Getsmstype(),Decodeunicode90()..etc
Can we get the shared function in vb6?
What is override,TP_PID?
i would like to decode received sms..
Thank you
|
|
|
|