Results 1 to 8 of 8

Thread: basic code convert

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    basic code convert

    who can convert this code(Visual Basic Code) to C# code

    VB Code:
    1. Dim objInstances As Object, objIE As Object
    2.     Set objInstances = CreateObject("Shell.Application").windows
    3.     If objInstances.Count > 0 Then
    4.         For Each objIE In objInstances
    5.             MsgBox objIE.LocationURL
    6.         Next
    7.     Else
    8.         MsgBox " no instances of explorer or InternetExplorer are open!"
    9.     End If

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Try this :
    Code:
    object objInstances=null;
    			objInstances=CreateObject("Shell.Application").windows;
    
    			if (objInstances.Count > 0)
    			{
    				foreach(object objIE in objInstances)
    				{
    					MessageBox.Show(objIE.LocationURL);
    				}
    			}
    			else
    			{
    				MessageBox.Show(" no instances of explorer or InternetExplorer are open!");
    			}

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2005
    Posts
    72

    Re: basic code convert

    C: \WindowsApplication29\Form1.cs(93): The name 'CreateObject' does not exist in the class or namespace 'WindowsApplication29.Form1'


  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Quote Originally Posted by ayman_rapper
    C: \WindowsApplication29\Form1.cs(93): The name 'CreateObject' does not exist in the class or namespace 'WindowsApplication29.Form1'

    http://www.dotnet247.com/247referenc...25/127340.aspx

  6. #6
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: basic code convert

    #Develop (the open source IDE) will convert C# to VB.NET and back.
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: basic code convert

    Quote Originally Posted by grilkip
    #Develop (the open source IDE) will convert C# to VB.NET and back.
    I've heard bad stories about SharpDevelop. So I never even tried it.

  8. #8
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: basic code convert

    Quote Originally Posted by mendhak
    I've heard bad stories about SharpDevelop. So I never even tried it.
    Perhaps, but its handy to quickly convert snippets of C# to VB.NET or vice versa
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width