|
Please some can tell me how to start a process when the windows starts.Well some one told me that we can do it by making some changes in win.ini files but there is no such thing in win.ini file. So can anyone help me in this problem.
|
|
|
|
|
If you want a application to start on Windows startup, then write your application as a Service. If you want it to start when a user logs in, then a normall application can be written and launched from the Registry's Run key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have this combo box populated with data column selected from access table, let's say it contains Employee id, "E001", "E002", "E003"
Now i need to pass the selected value in this combo box to a text box.
i.e. selected value in combo box is "E001" then textbox shows "E001"
|
|
|
|
|
Put this in the Combobox1 text changed area
textbox1.text=combobox1.text
duh
James Kennelly
|
|
|
|
|
OMG such a short code... i figure this out for hourss....
Anw Thanks for the reply James
|
|
|
|
|
Hi,
I have a navigation form worikng fine with add, update and so on...
I'm lost trying to insert a listview control so I can list child itens to the current item on my form.
Ex: hotel - hotel rooms - hotel room prices
I would like to list the hotel rooms related to my hotel (which is on my form already) and this list to also navigate as I click on my next and previous buttons for the Hotel record, then I would have a list its subitens on it.
Any ideas?
Thanks
|
|
|
|
|
Every time the Hotel information changes, you'll use the primary key ID of the Hotel record to search the database for the Hotel Rooms related to the key. Return those rooms in a table, then bind the ListBox to the datatable.
Sorry, I can't be more specific about how to accomplish this. You haven't given any details at all on how your doing what you've got so far and the controls your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to create a slash screen in vb.net?
I tried to look for so many information of creating slash screen, but most of them are using in vb 6.0 or under. It doesn't work in vb.net.
Lisa
|
|
|
|
|
Lisa,
Just create a regular form in VB.NET , typically you would change it's properties so it does not show a title bar or controlbox. Set the form as the startup object and have it call your application initialization code. If the initialization succeeds, have the form launch the main application form and then close itself. Or you can have the main application form initially hidden, then have the main application form show a splash screen. The second approach is a little easier to code in NET.
Although I think having a splash screen is still part of the overall presentation of an application, unfortunately much of the point of having a splash screen in the first place is to minimize the user's perception of startup time. This is compromised in NET because the framework itself has to load before you can even show a splash screen and in many cases the framework loading will represent a good percentage or even the majority of your start up time.
Robert
|
|
|
|
|
Thanks Robert.
How can I code the initializtion succeeds?
Private Sub frmSlash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim main As New frmMain
Dim slash As New frmSlash
slash.Show()
main.Hide()
'if the time > 2 second then ??how to code the condition??
'I want it to show up the main form after 2 second the slash form load
main.show()
slash.hide()
End Sub
Lisa
|
|
|
|
|
Create a module and use this code. Make sure you set the module as the startup program
Imports System.Threading
Module startmod
Dim threadsplash As Thread
Dim frmsplash As Form
Public Sub main()
frmsplash = New Splash
With frmsplash
.Show()
.Refresh()
End With
threadsplash = New Thread(AddressOf hidesplash)
threadsplash.Start()
Dim Form1 As New Form1
Application.Run(Form1)
End Sub
Private Sub hidesplash()
frmsplash.Opacity = 1
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.9
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.8
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.7
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.6
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.5
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.4
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Opacity = 0.3
frmsplash.Refresh()
threadsplash.Sleep(15)
frmsplash.Refresh()
frmsplash.Close()
End Sub
End Module
James Kennelly
|
|
|
|
|
|
A little simpler alternative is:
Sub Main:
Module modMain
Public Sub Main()
Dim frmMain As New frmMDIMain()
Dim frmSplash As New SplashScreen()
Dim fStart As Boolean = False
'Show the splash screen
frmSplash.Show()
'Run start up code in splash screen
fStart = frmSplash.RunInitialization
'Close the splash screen
frmSplash.Close()
'If startup was successful launch frmMain
If fStart Then
Application.Run(frmMain)
End If
End Sub
End Module
SplashScreen code
-------------------------------------------------------------------------------------------
Public Class SplashScreen
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
...
#End Region
Private m_fTimeout As Boolean
Public Function RunInitialization() As Boolean
'Enable wait timer
Me.tmrWait.Enabled = True
Dim fStart As Boolean = False
'Run your main Startup code wrapper function here
fStart = RunMyAppStartup()
'Process messages in wait loop until wait timer expires
'Don't care about performance hit of DoEvents for wait timer
While Not m_fTimeout
Application.DoEvents()
End While
'Return value of startup success to Sub Main()
Return fStart
End Function
Private Function RunMyAppStartup() As Boolean
'Your application startup function calls go here
'Just return True for example
Return True
End Function
Private Sub tmrWait_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrWait.Tick
Me.tmrWait.Enabled = False
'Set timeout flag to True
m_fTimeout = True
End Sub
Private Sub InitializeControls()
Me.lblVersion.Text = "Version: " & CURRENT_VERSION
Me.lblTitle.Text = Application.ProductName
End Sub
End Class
|
|
|
|
|
Ive been having this problem with a access database im writing. Im trying to use a form to query data from a table based off whats in a certain box on the form and putting it into word using mailmerge. Ive got the code down for the query and it works but heres the code im having trouble with.
Private Sub Command2_Click()
Dim objWord As Word.Document
Set objWord = GetObject("C:\QA\RB.doc", "Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\QA\QA.mdb", _
LinkToSource:=True, _
Connection:="QUERY test", _
SQLStatement:="SELECT * FROM test"
objWord.MailMerge.Execute
End Sub
The problem is that it opens the database again and i dont want it to i want it to get the information from the currently open database
Thanks
Nathan
|
|
|
|
|
It's doing exactly what you told it to. The OpenDataSource method you called will open the database using it's own connection, not yours. This should be no surprise considering you never gave (or even get the opportunity) to pass in an externally generated connection object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know that but how could i rewrite it to not do that. Im still kinda learning access VB.
Thanks for any help.
|
|
|
|
|
That's just it, you can't! There is no method provided by the MailMerge object that will allow you to supply a previously prepared connection object. MailMerge will always create and use it's own connection.
Why is this an issue anyway?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well what im trying to do is:
I need to create a mutipage report with different things on each page. So i figured i would use mailmerge but then i also need to be able to have the user pull a record of choice to be displayed in word for this mail merge. Which i have been able to accomplish the only problem was with opening the database and pulling the data i need from a form. Thanks for the help at least now i know its not possible. Do you have any idea on what would be a way to do this without mailmerge. Thanks again for your time.
Nathan
|
|
|
|
|
Well what im trying to do is:
I need to create a mutipage report with different things on each page. So i figured i would use mailmerge but then i also need to be able to have the user pull a record of choice to be displayed in word for this mail merge. Which i have been able to accomplish the only problem was with opening the database and pulling the data i need from a form. Thanks for the help at least now i know its not possible. Do you have any idea on what would be a way to do this without mailmerge. Thanks again for your time.
|
|
|
|
|
You have several options.
First, you can dynamically create a Query that MailMerge can execute to get the data it needs. Either plug the SQL statement directly into the MailMerge.OpenDataSource method, or build the query in Access and have MailMerge run that Query to get the data. You'll probably have to modify the query in Access first before you tell MailMerge to execute the query.
Next, use the appropriate tools for the job. MailMerge gets it's name from Mailing List. It merges a list of names and address into form letters and such. Though it can do more than just this, reporting is not it's forte. I would suggest using the Reporting features built into Access first.
Lastly, use an actualy reporting package, such a Crystal Reports.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does anyone know how to extract the amount of physical memory installed on a machine via registry using VB.net? The example below was written in KIX but I'm unable to replicate in VB.net. I'm having issues reading the data type REG_FULL_RESOURCE_DESCRIPTOR.
Any Help?
Thanks
<font face='Courier New' size=2 color=#4B0082><font color=#008000>;; FUNCTION Memory() </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; AUTHOR Glenn Barnas / FRIT-EROC </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; ACTION Returns the amount of Physical "color: rgba(0, 0, 0, 1); background-color: rgba(160, 255, 255, 1)">RAM in a local or remote system </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; SYNTAX Memory([system]) </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; VERSION 2.0 </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; DATE 2004/02/04 </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; DATE REVISED 2005/02/25 - updated </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; PARAMETERS System - OPTIONAL - name of system to query. Default is local system </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; REMARKS Returns "color: rgba(0, 0, 0, 1); background-color: rgba(160, 255, 255, 1)" size=""__^<br /><font color=#008000>;; Returns @ERROR on registry read failure, </font><br /><font color=#008000>;; or 13 / "Data is Invalid" if reg value is null </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; RETURNS Installed Physical ^__B style="color:black;background-color:#A0FFFF"__^RAM</b__^ (in Megabytes) </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; DEPENDENCIES None </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; TESTED WITH WinNT, Win2K, WinXP, Win2K3 </font><br /><font color=#008000>;; Tested with up to 6G of ^__B style="color:black;background-color:#A0FFFF"__^RAM </font><br /><font color=#008000>;; </font><br /><font color=#008000>;; EXAMPLES $^__B style="color:black;background-color:#A0FFFF"__^RAM = Memory('ThatPC') </font><br /><font color=#008000>;; </font><br /><font color=#008000>; </font><br /><font color=#0000FF>Function</font> Memory(<font color=#0000FF>Optional</font> <font color=#8B4513>$System</font>)<br /> <font color=#0000FF>Dim</font> <font color=#8B4513>$MemKey</font>, <font color=#8B4513>$HexDmp</font>, <font color=#8B4513>$Pointer</font>, <font color=#8B4513>$Counter</font>, <font color=#8B4513>$Start</font>, <font color=#8B4513>$Hex</font>, <font color=#8B4513>$HVal</font>, <font color=#8B4513>$Error</font>, <font color=#8B4513>$^__B style="color:black;background-color:#ffff66"__^Hex2Dec</font><br /> <font color=#008000>; Init the counter to account for base memory </font><br /> <font color=#8B4513>$Memory</font> = <font color=#FF0000>720.0</font><br /> <BR><br /> <font color=#008000>; Insure $System has "\\System\" format if it is specified </font><br /> <font color=#0000FF>If</font> <font color=#8B4513>$System</font> <^__b __^> <font color=#000000>''</font><br /> <font color=#8B4513>$System</font> = <font color=#000000>'\\'</font> + <font color=#FF0000>Join</font>(<font color=#FF0000>Split</font>(<font color=#8B4513>$System</font>,<font color=#000000>'\'</font>),<font color=#000000>''</font>,<font color=#FF0000>3</font>) + <font color=#000000>'\'</font><br /> <font color=#0000FF>EndIf</font><br /> <BR><br /> <font color=#008000>; Get the memory value from the registry </font><br /> <font color=#8B4513>$MemKey</font> = <font color=#8B4513>$System</font> + <font color=#000000>'HKEY_LOCAL_MACHINE\hardware\resourcemap\system resources\physical memory'</font><br /> <font color=#8B4513>$HexDmp</font> = <font color=#FF0000>ReadValue</font>(<font color=#8B4513>$MemKey</font>, <font color=#000000>'.Translated'</font>)<br /> <BR><br /> <font color=#008000>; Check for invalid read and return </font><br /> <font color=#0000FF>If</font> <font color=#FF0000>Len</font>(<font color=#8B4513>$HexDmp</font>) = <font color=#FF0000>0</font> Or <font color=#FF7F50>^__b__^@ERROR</font><br /> <font color=#8B4513>$Memory</font> = <font color=#FF0000>0</font> <font color=#008000>; return 0 Mbytes </font><br /> <font color=#8B4513>$Error</font> = <font color=#FF0000>IIf</font>(<font color=#FF7F50>^__b__^@ERROR</font>, <font color=#FF7F50>^__b__^@ERROR</font>, <font color=#FF0000>13</font>) <font color=#008000>; Return "Data is Invalid" if no error but data is blank </font><br /> <font color=#0000FF>Exit</font> <font color=#8B4513>$Error</font><br /> <font color=#0000FF>EndIf</font><br /> <BR><br /> <font color=#008000>; Resequence the bytes in the HexDump, starting in the 65th position, </font><br /> <font color=#008000>; and take 8 bytes every 32 bytes for the total memory amount, sum each set of values </font><br /> <font color=#0000FF>For</font> <font color=#8B4513>$Start</font> = <font color=#FF0000>65</font> <font color=#0000FF>To</font> <font color=#FF0000>Len</font>(<font color=#8B4513>$HexDmp</font>) <font color=#0000FF>Step</font> <font color=#FF0000>32</font><br /> <font color=#8B4513>$^__B style="color:black;background-color:#ffff66">Hex2Dec</font> = <font color=#FF0000>0.0</font><br /> <font color=#8B4513>$Hex</font> = <font color=#FF0000>SubStr</font>(<font color=#8B4513>$HexDmp</font>, <font color=#8B4513>$Start</font>+<font color=#FF0000>6</font>, <font color=#FF0000>2</font>)<br /> + <font color=#FF0000>SubStr</font>(<font color=#8B4513>$HexDmp</font>, <font color=#8B4513>$Start</font>+<font color=#FF0000>4</font>, <font color=#FF0000>2</font>)<br /> + <font color=#FF0000>SubStr</font>(<font color=#8B4513>$HexDmp</font>, <font color=#8B4513>$Start</font>+<font color=#FF0000>2</font>, <font color=#FF0000>2</font>)<br /> + <font color=#FF0000>SubStr</font>(<font color=#8B4513>$HexDmp</font>, <font color=#8B4513>$Start</font>, <font color=#FF0000>2</font>)<br /> <br /> <font color=#008000>; Simply taking the Val($Hex), can return negatives for values </font><br /> <font color=#008000>; Following logic adapted from a solution by Richard H. </font><br /> <font color=#0000FF>While</font> <font color=#8B4513>$Hex</font><br /> <font color=#8B4513>$^__B style="color:black;background-color:#ffff66">Hex2Dec</font> = <font color=#FF0000>16.0</font> * <font color=#8B4513>$^__B style="color:black;background-color:#ffff66">Hex2Dec</font> + <font color=#FF0000>Val</font>(<font color=#000000>'&'</font> + <font color=#FF0000>Left</font>(<font color=#8B4513>$Hex</font>,<font color=#FF0000>1</font>)) <font color=#008000>; convert next hex digit </font><br /> <font color=#8B4513>$Hex</font> = <font color=#FF0000>SubStr</font>(<font color=#8B4513>$Hex</font> ,<font color=#FF0000>2</font>) <font color=#008000>; then throw it away </font><br /> <font color=#0000FF>Loop</font> <font color=#008000>; until all are converted </font><br /> <font color=#8B4513>$Memory</font> = <font color=#8B4513>$Memory</font> + <font color=#FF0000>CDbl</font>(<font color=#8B4513>$^__B style="color:black;background-color:#ffff66">Hex2Dec</font>) / <font color=#FF0000>1024</font> <font color=#008000>; update running total </font><br /> <font color=#0000FF>Next</font><br /> <br /> <font color=#008000>; Reduce to Meg value </font><br /> <font color=#8B4513>$Memory</font> = <font color=#FF0000>CInt</font>(<font color=#8B4513>$Memory</font> / <font color=#FF0000>1024</font>)<br /><font color=#0000FF>EndFunction</font><br /> <BR></font>
|
|
|
|
|
Since you're using VB.NET, why not just skip the complicated math junk coming out of the Registry and get the data you want using WMI?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm trying to gather hardware info from Win2k, WinXP and WinNT machines (which do not have WMI installed.) Is there another method other than WMI for NT machines?
Thanks
|
|
|
|
|
Once the .NET Framework is installed on the machine, that's no longer a problem.
Or is there something else you're not telling us?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
???? .NET Framework is not installed on the NT machines. I'm querying these machines remotely.
Thanks
|
|
|
|