Hi , Hope you all are fine. Actually Situation is that i have 2 Forms. One is the main Application Form and other is like splash screen like form. I dont want splash screen form to be auto hide after some seconds. As there is some data i want to show to EnD uSer. i have added a check box on Splash Screen Welcome form.
Checkbox : "Dont Show this screen in Future"
Now i dont know when user checks this Checkbox and opens the application how can i save these settings. That this splash screen doesn't show itself in future. And in Application Options if the user selects that splash screen should appear at the start of application how can i do it
I shall be thankful to you for your kind Help.
Regards,
Adee

Need Your Help in Visual Basic Forums
CAPTGNVR
If it will be an installation then you could include a .ini file in the install dir that the program can access on startup to see if that certain option is active or not.
If your program will be a single executable file, then your best bet would be to make a registry entry and set a key to '1' if the option is active or '0' if the option is inactive. Your program can access the registry to check the value and, if active, will show the splash screen, or vice versa.
I hope you could understand what I am trying to get across to you. Have a nice day.
Brian Stern - MSFT
Thanks for your replies. But My this QUestion was just for VB 6.0 not for VB.Net. I am sorry i didn't mentioned earlier. I got some clues like saving settings in registry or using a text file to save a setting and then load that text file and read the settings from there. But i thought i may get some thing better from here.
Regards,
Adee
SM Gibbs
You want what's referred to as "application settings". Do a search on your MSDN help files for "application settings overview". These are settings that are loaded up at run-time (like 'do you want the splash screen to show'). Also, search on the class "ApplicationSettingsBase" that you can derive a new class from. That should be a good starting point for you to figure out how to save such information. Much of it is done for you by that base class.
Good luck!
sersul
Ali,
Please read the announcement at the top of the page....
Thanks!!!!!!
Punpromk
Khamal
Thanks alot for your informative and helpful reply. Yes this program is going to be installed on the user's hard drive.and yes thats the perfect idea of using some file to have a check on the options eg 0 for off and 1 for on while using checkbox.
Can you please help me further that how can i create and access .ini file I shall be thankful to you for this help and its alreay appriciated.
regards,
Adee
Daniel Moth
' --------------------------------------------------------------------------
' Module Name: clsSettingsINI
' Comments:
' Author: Irina Medvinskaya - TechRepubulic
' Created: November 2002.
' Revisions: Chris Van Duin - BHPSteel Lab Services.
' Modified code to work with my applications.
' Local variables used:
' mstrSection:
' mstrKey:
' mstrININame:
' mintError:
' mstrErrMsg:
' --------------------------------------------------------------------------
Option Explicit
Public Event Error(ByVal Code As Integer, ByVal Description As String)
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Long
Private mstrSection As String
Private mstrKey As String
Private mstrININame As String
Private mintError As Integer
Private mstrErrMsg As String
Private Const ERR_READ_FAILED As Integer = 1
Private Const ERR_WRITE_FAILED As Integer = 2
' --------------------------------------------------------------------------
' Name: Property Get Error
' Comments:
' Written By: Irina Medvinskaya - 5th November, 2002.
' Modified By: Chris Van Duin - 6th December, 2002.
' Modifications: None.
' Parameters: None.
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used: None.
' --------------------------------------------------------------------------
'
Public Property Get Error() As Integer
Error = mintError
End Property
' --------------------------------------------------------------------------
' Name: Property Get ErrMsg
' Comments:
' Written By: Chris Van Duin - 6th December, 2002.
' Modified By:
' Modifications: None.
' Parameters: None.
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used: None.
' --------------------------------------------------------------------------
'
Public Property Get ErrMsg() As String
ErrMsg = mstrErrMsg
End Property
' --------------------------------------------------------------------------
' Name: Property Let ININame
' Comments:
' Written By: Irina Medvinskaya - 5th November, 2002.
' Modified By: Chris Van Duin - 6th December, 2002.
' Modifications: None.
' Parameters:
' strININame:
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used: None.
' --------------------------------------------------------------------------
'
Public Property Let ININame(strININame As String)
mstrININame = strININame
End Property
' --------------------------------------------------------------------------
' Name: Property Let Key
' Comments:
' Written By: Irina Medvinskaya - 5th November, 2002.
' Modified By: Chris Van Duin - 6th December, 2002.
' Modifications: None.
' Parameters:
' strKey:
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used: None.
' --------------------------------------------------------------------------
'
Public Property Let Key(strKey As String)
mstrKey = strKey
End Property
' --------------------------------------------------------------------------
' Name: Property Let Section
' Comments:
' Written By: Irina Medvinskaya - 5th November, 2002.
' Modified By: Chris Van Duin - 6th December, 2002.
' Modifications: None.
' Parameters:
' strSection:
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used: None.
' --------------------------------------------------------------------------
'
Public Property Let Section(strSection As String)
mstrSection = strSection
End Property
' --------------------------------------------------------------------------
' Name: ReadINISettings
' Comments:
' Written By: Chris Van Duin - 6th December, 2002.
' Modified By: Chris Van Duin - 6th December, 2002.
' Modifications: None.
' Parameters: None.
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used:
' strDestination:
' lngReturnVal:
' --------------------------------------------------------------------------
'
Public Function ReadINISettings() As String
On Error GoTo Local_Handler
Dim strDestination As String * 255
Dim lngReturnVal As Long
lngReturnVal = GetPrivateProfileString(mstrSection, mstrKey, "", strDestination, Len(strDestination), mstrININame)
'lngReturnVal will always equal the length of the returned string not including vbNullChar 's at the end!!!
If lngReturnVal <> 0 Then
strDestination = Left$(strDestination, InStr(strDestination, Chr(0)) - 1) 'chr(0)=vbNullChar
ReadINISettings = Trim$(strDestination)
Else
mintError = ERR_READ_FAILED
mstrErrMsg = "There was an error reading from the file:" & _
vbLf & vbTab & mstrININame & _
vbLf & vbLf & "Possible causes: " & _
vbLf & vbTab & "1) The file does not exist." & _
vbLf & vbTab & "2) The path is incorrect." & _
vbLf & vbTab & "3) One of the following values may have caused the error:" & _
vbLf & vbTab & vbTab & "Section:" & vbTab & mstrSection & _
vbLf & vbTab & vbTab & "Key:" & vbTab & mstrKey
RaiseEvent Error(ERR_READ_FAILED, mstrErrMsg)
End If
Exit Function
Local_Handler:
RaiseEvent Error(ERR_READ_FAILED, mstrErrMsg)
End Function
' --------------------------------------------------------------------------
' Name: WriteINISettings
' Modified By: Chris Van Duin - 6th December, 2002.
' Written By: Irina Medvinskaya - 5th November, 2002.
' Modified By:
' Modifications: None.
' Parameters:
' strSetting:
' Returns: Nothing.
' Affected Parameters: None.
' Local variables used:
' lngReturnVal:
' strMessage:
' --------------------------------------------------------------------------
'
Public Sub WriteINISettings(ByVal strSetting As String)
On Error GoTo Local_Handler
Dim lngReturnVal As Long
Dim strMessage As String
lngReturnVal = WritePrivateProfileString(mstrSection, mstrKey, strSetting, mstrININame)
If lngReturnVal = 0 Then
mintError = ERR_WRITE_FAILED
mstrErrMsg = "There was an error writing to the file:" & _
vbLf & vbTab & mstrININame & _
vbLf & vbLf & "Possible causes: " & _
vbLf & vbTab & "The file may be write protected."
RaiseEvent Error(ERR_WRITE_FAILED, mstrErrMsg)
Exit Sub
End If
Exit Sub
Local_Handler:
RaiseEvent Error(ERR_WRITE_FAILED, mstrErrMsg)
End Sub
This will work with .NET too but you may need to make a few changes. In both cases you have to include a reference to Microsoft Scripting Runtime.
Your settings.ini file may look something like this:
# Initialisation setting Options
#
# Database Connection options:
# 0 = Lab Server 2 (FPDWOL-BOSLAB2)
# 1 = Lab Server (FPDWOL-BOSLAB)
# 2 = Laptop (PC6942)
# 3 = Laptop (CROSSMULLER)
# 4 = Laptop (Gavin Hughes)
# 5 = Home (COMP1)
#
# Log Data
# 0 = Do not log analysis data to database - store to local
# hard drive instead.
# 1 = Log to SQL server as specified in Database Connection
#
# Track Samples
# 0 = Do not log tracking information (ie, movig and closing lots)
# to local comms log file. Used for debugging purposes.
# 1 = Log tracking information to comms log file.
#
# Days to Keep Log Files
# Must be greater than 1. The number of days to keep a log file.
# After the set period log files will be removed.
# There are three log files being kept:
# CommsLog - General communication log.
# TransLog - Analysis transmissions received from instrument.
# UDPLog - Log of status messages received via the UDP sockets.
#
# Transmissions
# 0 = Turn off transmissions to external systems, ie disables UDP messages.
# 1 = Turn on transmissions to external systems.
# --------------------------------------------------------------------------------
[Instrument Settings]
Instrument=0
Spectro No=1
[Com Port Settings]
Com Port=1
Baud Rate=9600
[UDP Socket Settings]
UDP Courier Remote Port=5000
UDP Courier Local Port=5001
UDP Server Remote Port=4000
UDP Server Local Port=4001
[Host Names]
Courier Host PC Name=AAB09192
Server Host PC Name=AAC56598
[Database Settings]
Database Connection=0
Log Data=True
Track Samples=False
[Log File Settings]
Days to Keep Log Files=14
[Analysis Transmission Settings]
Transmissions=True