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. Windows Forms
  4. FillByCountry From MSSQL

FillByCountry From MSSQL

Scheduled Pinned Locked Moved Windows Forms
csharpsql-server
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.
  • S Offline
    S Offline
    Sider89
    wrote on last edited by
    #1

    I want to do this: When I'll click at the CountryName column(England), I want redirect it to me in the new form where will be corresponding CityNames(London, Birmingem,Liverpool and etc) in countryForms I have: <pre> private void dataGridView1_DoubleClick(object sender, EventArgs e)             { // here when I call Citys new City("I want Parameter here").showdialog(); //I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows)                   {                      int b = (int)item["ID"];                                     }             } </pre> but it is not what I want :( In CityForms: <pre> private int CountryID;             //Form1 f;             public Cities(int countryID)             {                   InitializeComponent();                   CountryID = countryID;                   //f = new Form1();             }             public void Cities_Load(object sender, EventArgs e)             {                   this.citiesTableAdapter.Fill(storeHouseDataSet.Cities);                   this.citiesTableAdapter.FillByCountry(storeHouseDataSet.Cities, CountryID);             } </pre>

    C# Developer

    L 1 Reply Last reply
    0
    • S Sider89

      I want to do this: When I'll click at the CountryName column(England), I want redirect it to me in the new form where will be corresponding CityNames(London, Birmingem,Liverpool and etc) in countryForms I have: <pre> private void dataGridView1_DoubleClick(object sender, EventArgs e)             { // here when I call Citys new City("I want Parameter here").showdialog(); //I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows)                   {                      int b = (int)item["ID"];                                     }             } </pre> but it is not what I want :( In CityForms: <pre> private int CountryID;             //Form1 f;             public Cities(int countryID)             {                   InitializeComponent();                   CountryID = countryID;                   //f = new Form1();             }             public void Cities_Load(object sender, EventArgs e)             {                   this.citiesTableAdapter.Fill(storeHouseDataSet.Cities);                   this.citiesTableAdapter.FillByCountry(storeHouseDataSet.Cities, CountryID);             } </pre>

      C# Developer

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      West1989 wrote:

      //I am trying to find this parameter like this foreach (DataRows item in storeHouseDataSet.Countries.Rows) { int b = (int)item["ID"]; } } but it is not what I want

      1. What is it that you do want? 2. Assuming you want 'b' to have some usable value, then you need to define b in the outer scope, and also break out of the loop when you hit the right value. Perhaps you could clarify your question?

      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