Solved

Any one Help me I want to convert vb code  to c# code

Posted on 2007-11-14
3
229 Views
Last Modified: 2010-04-15
Public Sub loadUrl()
        Dim oFSO As FileSystemObject

        Set oFSO = New FileSystemObject
        Set propFile = oFSO.OpenTextFile(App.Path & "\sfa.properties", 1)

        'Read motoURL from sfa.properties file.
        If (propFile.AtEndOfStream <> True) Then
            strurl = propFile.ReadLine
            mypos = InStr(1, strurl, "=", 1)
            motoURL = Mid(strurl, mypos + 1, Len(strurl) - mypos)
        End If
        If motoURL = "" Then
             Err.Number = 1
             Err.description = "Error in the properties file. Value for motoURL is not mentioned or is invalid"
             Err.Source = "loadUrl"
             Call checkErrors(Err.description)
             Exit Sub
        End If

       
    End Sub
0
Comment
Question by:sitg
3 Comments
 
LVL 16

Accepted Solution

by:
gnoon earned 500 total points
ID: 20287371
private void loadUrl() {
  System.IO.StreamReader propFile = null;
  try {
    propFile = System.IO.File.OpenText("sfa.properties");
    string strurl = propFile.ReadLine();
    motoURL = strurl.Substring(strurl.IndexOf("=")+1);
  } catch(Exception e) {
    checkErrors("Error in the properties file. Value for motoURL is not mentioned or is invalid");
  } finally {
    if(propFile != null) propFile.Close();
  }
}
0
 
LVL 4

Expert Comment

by:rallsaldo
ID: 20288170
Hi,

This may be of help in future:

http://labs.developerfusion.co.uk/convert/vb-to-csharp.aspx

Cheers,
R
0
 

Author Comment

by:sitg
ID: 20310397
thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now