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

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

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

        'Read motoURL from 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
Question by:sitg
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
LVL 16

Accepted Solution

gnoon earned 500 total points
ID: 20287371
private void loadUrl() {
  System.IO.StreamReader propFile = null;
  try {
    propFile = System.IO.File.OpenText("");
    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();

Expert Comment

ID: 20288170

This may be of help in future:


Author Comment

ID: 20310397

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