Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to Convert this in C#

How to Convert this in C#

Scheduled Pinned Locked Moved C#
csharpdata-structureshelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    majidbhutta
    wrote on last edited by
    #1

    Well! i m having some trouble in writing this piece of code in c#. i m having some type conversion erros pls help me specially the loop portion Dim ids As Object ScannerManager.EnumDeviceIDs(ids) List.Items.Clear() Dim i As Integer For i = LBound(ids) To UBound(ids) List.Items.Add(ids(i)) Next i // signature and prototype information 'EnumDeviceIDs(ref Object) returns array of strings that contain info 'public virtual new void EnumDeviceIDs ( System.Object IDs ) I M new in .net p

    P 2 Replies Last reply
    0
    • M majidbhutta

      Well! i m having some trouble in writing this piece of code in c#. i m having some type conversion erros pls help me specially the loop portion Dim ids As Object ScannerManager.EnumDeviceIDs(ids) List.Items.Clear() Dim i As Integer For i = LBound(ids) To UBound(ids) List.Items.Add(ids(i)) Next i // signature and prototype information 'EnumDeviceIDs(ref Object) returns array of strings that contain info 'public virtual new void EnumDeviceIDs ( System.Object IDs ) I M new in .net p

      P Offline
      P Offline
      philip_cole
      wrote on last edited by
      #2

      [Message Deleted]

      1 Reply Last reply
      0
      • M majidbhutta

        Well! i m having some trouble in writing this piece of code in c#. i m having some type conversion erros pls help me specially the loop portion Dim ids As Object ScannerManager.EnumDeviceIDs(ids) List.Items.Clear() Dim i As Integer For i = LBound(ids) To UBound(ids) List.Items.Add(ids(i)) Next i // signature and prototype information 'EnumDeviceIDs(ref Object) returns array of strings that contain info 'public virtual new void EnumDeviceIDs ( System.Object IDs ) I M new in .net p

        P Offline
        P Offline
        philip_cole
        wrote on last edited by
        #3

        Hi Its not clear from the code exactly what the EnumDeviceIDS method creates ids as, but i'll assume it is a .NET string array. In which case the code should be something like: // ids is initially null; object ids = null; ScannerManager.EnumDeviceIDs(ref ids); // we now need to convert ids to an array to let us loop string[] arrids = (string[])ids; List.Items.Clear(); // our for loop can become a nicer foreach foreach(string id in arrids) { List.Items.Add(str); } /* This is all just explanation, so is commented * // signature and prototype information * EnumDeviceIDs(ref Object) * returns array of strings that contain info * 'public virtual new void EnumDeviceIDs ( System.Object IDs ) */ Hope this helps Philip :-D -- modified at 15:18 Saturday 3rd September, 2005

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups