1

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.

Balagurunathan Marimuthu
  • 2,927
  • 4
  • 31
  • 44
  • The exception doesn't seem to be relevant to the config file, but it's related to the code and the way you read config and set com port configurations. So to get some help, you need to share the code. – Reza Aghaei Oct 17 '16 at 07:40
  • Is there any generic way to suppress these message boxes? – Shahbaz Shah Oct 17 '16 at 08:02

0 Answers0