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. Converting BindingSource and Guid [solved]

Converting BindingSource and Guid [solved]

Scheduled Pinned Locked Moved C#
csharp
4 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
    Midnight Ahri
    wrote on last edited by
    #1

    usually in vb.net i do like this,

    Dim id As Guid = DirectCast(DirectCast(Me.ABCBindingSource.Current, DataRowView)("IdABC"), Guid)

    but in C# is like this,

    Guid id = ((DataRowView)this.ABCBindingSource.Current)["IdABC"];

    tried a lot of code to convert it to Guid and all fail. :sigh: even this way didn't works.

    Guid id = Convert.ChangeType(((DataRowView)this.categoryBindingSource.Current)["IdCategory"],Guid);

    Edit : omg randomly write and i got like this,

    Guid id = (Guid)((DataRowView)this.categoryBindingSource.Current)["IdCategory"];

    real hard to move from vb.net to c#.. :sigh:

    OriginalGriffO 1 Reply Last reply
    0
    • M Midnight Ahri

      usually in vb.net i do like this,

      Dim id As Guid = DirectCast(DirectCast(Me.ABCBindingSource.Current, DataRowView)("IdABC"), Guid)

      but in C# is like this,

      Guid id = ((DataRowView)this.ABCBindingSource.Current)["IdABC"];

      tried a lot of code to convert it to Guid and all fail. :sigh: even this way didn't works.

      Guid id = Convert.ChangeType(((DataRowView)this.categoryBindingSource.Current)["IdCategory"],Guid);

      Edit : omg randomly write and i got like this,

      Guid id = (Guid)((DataRowView)this.categoryBindingSource.Current)["IdCategory"];

      real hard to move from vb.net to c#.. :sigh:

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Does that mean you found the solution - because the (Guid) option is the one I would have gone for first... If you solve it yourself, please edit the question and add "[Solved]" to the subject line - that way it's obvious!

      Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Does that mean you found the solution - because the (Guid) option is the one I would have gone for first... If you solve it yourself, please edit the question and add "[Solved]" to the subject line - that way it's obvious!

        Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

        M Offline
        M Offline
        Midnight Ahri
        wrote on last edited by
        #3

        okay, thank you.. :)

        OriginalGriffO 1 Reply Last reply
        0
        • M Midnight Ahri

          okay, thank you.. :)

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          You're welcome! :laugh:

          Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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