Results 1 to 5 of 5

Thread: Making if statements "re-check" themselves

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    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.

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    for .ini files here's an example i made a while back to help someone on the dotnet forum :
    VB Code:
    1. Imports System.Text
    2. '///at top of code page^^^
    3.  
    4.     <DllImport("kernel32.dll")> _
    5.         Private Overloads Shared Function WritePrivateProfileString( _
    6.         ByVal lpApplicationName As String, _
    7.         ByVal lpKeyName As String, _
    8.         ByVal lpString As String, _
    9.         ByVal lpFileName As String) As Integer
    10.     End Function
    11.     <DllImport("kernel32.dll")> _
    12.         Private Overloads Shared Function GetPrivateProfileString( _
    13.             ByVal lpApplicationName As String, _
    14.             ByVal lpKeyName As String, _
    15.             ByVal lpDefault As String, _
    16.             ByVal lpReturnedString As StringBuilder, _
    17.             ByVal nSize As Integer, _
    18.             ByVal lpFileName As String) As Integer
    19.     End Function
    20. '/// under the designer generated code area^^^
    21.  
    22.    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    23.         WritePrivateProfileString("this", "KeyName", "This is the value", "c:\test.ini")
    24.         Dim str As New StringBuilder(256)
    25.         Dim l As Integer
    26.         l = GetPrivateProfileString("this", "KeyName", "Default", str, str.Capacity, "C:\test.ini")
    27.         MsgBox(str.ToString())
    28.     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]

  3. #3

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    It says DllImport is not defined

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    oops silly me , you need this line also at the top of yer form :
    VB Code:
    1. 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]

  5. #5

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    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
  •  



Click Here to Expand Forum to Full Width