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. LINQ
  4. how to add ---select---- in the combobox

how to add ---select---- in the combobox

Scheduled Pinned Locked Moved LINQ
databasetutorialquestion
2 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.
  • N Offline
    N Offline
    Nilish
    wrote on last edited by
    #1

    I have a table , table name is table1 it has following fields. Column1 , column2 , column3 , column4 Now I write the following query

    Dim query = from p in baseclass.gettable(of table1) _
    Select p.column1 , p.column2

    Now this query is the anonymous type. Now I want to insert one more row at position 1 at runtime.

    That’s row’s display string is “----select----”
    And it’s value member is “-1”

    How should i add this row in Query variable? I want to check if there is not record , then I gives nothing, In case of nothing , how should I add the record.

    J 1 Reply Last reply
    0
    • N Nilish

      I have a table , table name is table1 it has following fields. Column1 , column2 , column3 , column4 Now I write the following query

      Dim query = from p in baseclass.gettable(of table1) _
      Select p.column1 , p.column2

      Now this query is the anonymous type. Now I want to insert one more row at position 1 at runtime.

      That’s row’s display string is “----select----”
      And it’s value member is “-1”

      How should i add this row in Query variable? I want to check if there is not record , then I gives nothing, In case of nothing , how should I add the record.

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      You can use the Concat method to concatenate lists together. So, if you wanted to insert a "--select--" string at position 1 in a list of strings, you could do it like this:

      string[] valueToInsert = { "--select--"; };
      string[] otherValues = { "foo", "bar", "baz", "bat" };

      var result = valueToInsert.Concat(otherValues);

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Upon this disciple I'll build my new religion? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      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