Shahbaz Shah
Shahbaz Shah

Reputation: 11

XML Custom Configuration Error Handling

Here is some code of my app.config file in my windows form application. I used this configuration file for the printer and scanner. I have used custom configurations in this xml. The problem I'm facing is whenever any attribute value is not set, My application throws a built in message error box like "The port com 4 does not exists"

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
    <add key="Server" value="blah blah" />
    <add key="Database" value="blah" />
    <add key="User" value="blah" />
    <add key="StoreID" value="blah" />
    <add key="BranchID" value="blah" />
    <add key="LotSize" value="100"/>
    <add key="ZipsPrintingPath" value="blah.exe"/>
    <add key="BCScannerPath" value="blah.exe"/>

    <add key="SecuGenDeviceName" value="DEV_AUTO"/>
    <add key="SecuGenPortAddress" value="USB_AUTO_DETECT"/>
    <add key="SecuGenLiveTimeout" value="15000"/>
    <add key="SecuGenImageQuality" value="50"/>


    <add key="BCSPort" value="COM4"/>
    <add key="BCSBaudRate" value="9600"/>
    <add key="BCSParity" value="None"/>
    <add key="BCSByteSize" value="8"/>
    <add key="BCSStopBit" value="One"/>

    <add key="BTicketBarcodeStartsWith" value="%B"/>
    <add key="BTicketBarcodeEndsWith" value="."/>
    <add key="TechSupportURL" value="blah"/>
    </appSettings>
</configuration>

Here is also attached port error.

Now, I want to suppress this message box or I want to show this message in my custom message box.

Upvotes: 1

Views: 52

Answers (0)

Related Questions