Solved

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

Posted on 2007-11-14
3
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

623 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