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. Filing Combobox with alphabet

Filing Combobox with alphabet

Scheduled Pinned Locked Moved C#
12 Posts 7 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.
  • C conemajstor

    I want to fill my combo box with alphabet

    nemanja

    M Offline
    M Offline
    MoustafaS
    wrote on last edited by
    #2

    And ?

    ------------------------------
    "The Soapbox has been so ..."

    C 1 Reply Last reply
    0
    • M MoustafaS

      And ?

      ------------------------------
      "The Soapbox has been so ..."

      C Offline
      C Offline
      conemajstor
      wrote on last edited by
      #3

      Automaticly!! Not Manual!

      nemanja

      E 1 Reply Last reply
      0
      • C conemajstor

        I want to fill my combo box with alphabet

        nemanja

        B Offline
        B Offline
        bobsugar222
        wrote on last edited by
        #4

        private void PopulateComboBox()
        {
        for (int i = 65; i < 91; i++)
        {
        comboBox1.Items.Add(Convert.ToChar(i));
        }
        }

        1 Reply Last reply
        0
        • C conemajstor

          Automaticly!! Not Manual!

          nemanja

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #5

          Create a custom control. Then you only have to create it once.

          1 Reply Last reply
          0
          • C conemajstor

            I want to fill my combo box with alphabet

            nemanja

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #6

            Here is one way: for (char i = 'A'; i <= 'Z'; i++) comboBox1.Items.Add(i);

            --- Year happy = new Year(2007);

            B 1 Reply Last reply
            0
            • G Guffa

              Here is one way: for (char i = 'A'; i <= 'Z'; i++) comboBox1.Items.Add(i);

              --- Year happy = new Year(2007);

              B Offline
              B Offline
              bobsugar222
              wrote on last edited by
              #7

              Well I didn't know you could increment chars. Assimilated :)

              C 1 Reply Last reply
              0
              • B bobsugar222

                Well I didn't know you could increment chars. Assimilated :)

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                A char automatically converts to an int, I believe.  It definatley does in c++.

                Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                G 1 Reply Last reply
                0
                • C conemajstor

                  I want to fill my combo box with alphabet

                  nemanja

                  E Offline
                  E Offline
                  Ennis Ray Lynch Jr
                  wrote on last edited by
                  #9

                  comboBox.DataSource = {'a','b','c','d','e','f','g','h','i','j','k' ... 'z'};

                  Just being funny. But itll work.


                  File Not Found

                  G 1 Reply Last reply
                  0
                  • C Christian Graus

                    A char automatically converts to an int, I believe.  It definatley does in c++.

                    Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #10

                    Not automatically, you have to cast it. A char in C# is a unicode character, while a char in C++ is actually not a character at all, but a byte.

                    --- Year happy = new Year(2007);

                    1 Reply Last reply
                    0
                    • E Ennis Ray Lynch Jr

                      comboBox.DataSource = {'a','b','c','d','e','f','g','h','i','j','k' ... 'z'};

                      Just being funny. But itll work.


                      File Not Found

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #11

                      Here's another funny one. :)

                      public static class Alphabet {

                      public static IEnumerator Lower() {
                      for (char i = 'a'; i <= 'z'; i++) yield return i;
                      }

                      public static IEnumerator Upper() {
                      for (char i = 'A'; i <= 'Z'; i++) yield return i;
                      }

                      }

                      foreach (char i in Alphabet.Lower()) comboBox1.Items.Add(i);

                      --- Year happy = new Year(2007);

                      E 1 Reply Last reply
                      0
                      • G Guffa

                        Here's another funny one. :)

                        public static class Alphabet {

                        public static IEnumerator Lower() {
                        for (char i = 'a'; i <= 'z'; i++) yield return i;
                        }

                        public static IEnumerator Upper() {
                        for (char i = 'A'; i <= 'Z'; i++) yield return i;
                        }

                        }

                        foreach (char i in Alphabet.Lower()) comboBox1.Items.Add(i);

                        --- Year happy = new Year(2007);

                        E Offline
                        E Offline
                        Ennis Ray Lynch Jr
                        wrote on last edited by
                        #12

                        thats what I wrote the first time. But I created an interface first then I deleted the entire post because I was afraid someone would think I was serious.


                        File Not Found

                        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