Results 1 to 8 of 8

Thread: [RESOLVED] How to add code to the app.config file?

  1. #1

    Thread Starter
    Banned
    Join Date
    Oct 2015
    Location
    Earth
    Posts
    175

    Resolved [RESOLVED] How to add code to the app.config file?

    Hi experts,
    As https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx explains;

    If your application relies on consistent behavior regardless of the operating system, you can force the SendKeys class to use the new implementation by adding the following application setting to your app.config file.
    Code:
    <appSettings>
    <add key="SendKeys" value="SendInput"/>
    </appSettings>
    Following picture shows my app.config file.
    http://prntscr.com/8zhtxo

    Question: How to integrate code above into my app.config file?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to add code to the app.config file?

    The config file is XML. You simply copy that XML snippet into the file. The <appSettings> element must be inside the main <configuration> element.

  3. #3

    Thread Starter
    Banned
    Join Date
    Oct 2015
    Location
    Earth
    Posts
    175

    Re: How to add code to the app.config file?

    Quote Originally Posted by jmcilhinney View Post
    The config file is XML. You simply copy that XML snippet into the file. The <appSettings> element must be inside the main <configuration> element.
    Is it correct?
    http://prntscr.com/8zk30v

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to add code to the app.config file?

    There's no need to make us visit other web sites when you can simply attach a screen shot to your post or simply paste your code directly.

  5. #5

    Thread Starter
    Banned
    Join Date
    Oct 2015
    Location
    Earth
    Posts
    175

    Re: How to add code to the app.config file?

    Other codes located between <system.diagnostics>.
    Are you sure this is correct?

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      
      <appSettings>
        <add key="SendKeys" value="SendInput"/>
      </appSettings>
      
        <system.diagnostics>
          
            <sources>
                <!-- This section defines the logging configuration for My.Application.Log -->
                <source name="DefaultSource" switchName="DefaultSwitch">
                    <listeners>
                        <add name="FileLog"/>
                        <!-- Uncomment the below section to write to the Application Event Log -->
                        <!--<add name="EventLog"/>-->
                    </listeners>
                </source>
            </sources>
          
            <switches>
                <add name="DefaultSwitch" value="Information" />
            </switches>
          
            <sharedListeners>
                <add name="FileLog"
                     type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
                     initializeData="FileLogWriter"/>
                <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
                <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
            </sharedListeners>
          
        </system.diagnostics>
      
     
    </configuration>

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to add code to the app.config file?

    That looks OK to me. VS should tell you if anything is in a place that it shouldn't. You could always do some reading on the subject if you have doubts.

  7. #7

    Thread Starter
    Banned
    Join Date
    Oct 2015
    Location
    Earth
    Posts
    175

    Re: How to add code to the app.config file?

    Thank you...

    Another issue;
    What does following explanation exactly mean ?

    If your application relies on consistent behavior regardless of the operating system, you can force the SendKeys class to use the new implementation by adding the following application setting to your app.config file.
    Code:
    <appSettings>
    <add key="SendKeys" value="SendInput"/>
    </appSettings>
    Source:
    https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to add code to the app.config file?

    Quote Originally Posted by Herry Markowitz View Post
    Thank you...

    Another issue;
    What does following explanation exactly mean ?


    Code:
    <appSettings>
    <add key="SendKeys" value="SendInput"/>
    </appSettings>
    Source:
    https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx
    It's explained in the two paragraphs directly above that one.

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