|
-
Jul 23rd, 2003, 06:59 PM
#1
Making if statements "re-check" themselves
I'm going to have a preferences section on my program, basicly it will be mostly true or false statements.
My question is, say I have a couple of events with if statements which check to see if certain options are enabled. Later on, someone opens the preferences and changes an option and clicks OK. Is there anyway for me to tell everything to like re-check themselves or will me.update() do that?
I didn't want to put everything in loops cause I'm not sure how much performance that would demand if like 30 loops are running at once checking if certain options are enabled.
Also, if anyone has links to reading and writing .ini files, please post them. I haven't had time to look up any info on them yet so it's not a big deal if you don't, I can probably search for the info.
-
Jul 23rd, 2003, 08:23 PM
#2
for .ini files here's an example i made a while back to help someone on the dotnet forum :
VB Code:
Imports System.Text
'///at top of code page^^^
<DllImport("kernel32.dll")> _
Private Overloads Shared Function WritePrivateProfileString( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Integer
End Function
<DllImport("kernel32.dll")> _
Private Overloads Shared Function GetPrivateProfileString( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As StringBuilder, _
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
End Function
'/// under the designer generated code area^^^
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WritePrivateProfileString("this", "KeyName", "This is the value", "c:\test.ini")
Dim str As New StringBuilder(256)
Dim l As Integer
l = GetPrivateProfileString("this", "KeyName", "Default", str, str.Capacity, "C:\test.ini")
MsgBox(str.ToString())
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jul 23rd, 2003, 08:35 PM
#3
It says DllImport is not defined
-
Jul 23rd, 2003, 08:41 PM
#4
oops silly me , you need this line also at the top of yer form :
VB Code:
Imports System.Runtime.InteropServices
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jul 23rd, 2003, 08:48 PM
#5
Thanks! Works fine! Now I should be able to figure out how to write all of my needed things to it.
Anyone got an answer to my If Statement question?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|