.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Bible Psalms chapter and verses generation(c#.net).

Posted By:laptop charles       Posted Date: December 23, 2010    Points: 15    Category: Visual Studio    URL: http://www.dotnetspark.com  

It has using three combobox and using simple if and swith statement. This program is to generate how many chapter and verses available in psalms.
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Psalms_chapter_and_verses_generator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int ch;
        void loop(int ch)
        {
            for (int i = 1; i <= ch; i++)
            {
                comboBox2.Items.Add(i);
            }
        }
        void loop1(int ch)
        {
            for (int i = 1; i <= ch; i++)
            {
                comboBox3.Items.Add(i);
            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem.ToString() == "Psalms")
            {
                ch = 150;
                loop(ch);

            }
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            switch (comboBox2.SelectedItem.ToString())
            {
                case "1":
                case "13":
                case "23":
                case "53":
                case "126":
                case "128":
                case "150":
                    comboBox3.Items.Clear();
                     ch = 6;
                     loop1(ch);
                    break;
                case "2":
                case "5":
                case "26":
                case "30":
                case "36":
                case "60":
                case "62":
                case "76":
                case "84":
                case "97":
                case "143":
 
 
                    comboBox3.Items.Clear();
                    ch = 12;
                    loop1(ch);
                    break;
                case "3":
                case "4":
                case "12":
                case "61":
                case "82":
                case "101":
                case "114":
                case "121":
                case "124":
                case "129":
                case "130":
                case "138":
                    comboBox3.Items.Clear();
                    ch = 8;
                    loop1(ch);
                    break;
                
                                  
                case "6":
                case "24":
                case "64":
                case "75":
                case "111":
                case "112":
                case "141":
                case "146":

                    comboBox3.Items.Clear();
                    ch = 10;
                    loop1(ch);
                    break;
                case "7":
                case "45":
                case "40":
                case "56":
                case "59":
                case "86":
                case "90":
                    comboBox3.Items.Clear();
                    ch = 17;
                    loop1(ch);
                    break;
                case "8":
                case "20":
                case "47":
                case "28":
                case "52":
                case "98":
                case "99":
                case "113":
                case "122":
                case "137":
                case "149":

                    comboBox3.Items.Clear();
                    ch = 9;
                    loop1(ch);
                    break;
                case "9":
                case "49":
                case "66":
                case "72":
                case "77":
                case "147":
                    comboBox3.Items.Clear();
                    ch = 20;
                    loop1(ch);
                    break;
                case "10":
                case "83":
                case "88":
                case "115":
                case "132":
                    comboBox3.Items.Clear();
                    ch = 18;
                    loop1(ch);
                    break;
                case "11":
                case "14":
                case "54":
                case "67":
                case "87":
                case "110":
                case "120":
                case "142":
                    comboBox3.Items.Clear();
                    ch = 7;
                    loop1(ch);
                    break;              
                case "15":
                case "43":
                case "70":
                case "93":
                case "100":
                case "125":
                case "127":
                    comboBox3.Items.Clear();
                    ch = 5;
                    loop1(ch);
                    break;
                case "16":
                case "46":
                case "42":
                case "32":
                case "29":
                case "57":
                case "58":
                case "63":
                case "95":
                    comboBox3.Items.Clear();
                    ch = 11;
                    loop1(ch);
                    break;
                case "17":
                case "92":
                case "144":
                    comboBox3.Items.Clear();
                    ch = 15;
                    loop1(ch);
                    break;
                case "18":
                    comboBox3.Items.Clear();
                    ch = 50;
                    loop1(ch);
                    break;
                case "19":
                case "27":
                case "48":
                case "148":
                    comboBox3.Items.Clear();
                    ch = 14;
                    loop1(ch);
                    break;
                case "25":
                case "33":
                case "34":
                case "38":
                case "103":
                
                    comboBox3.Items.Clear();
                    ch = 22;
                    loop1(ch);
                    break;
                case "21":
                case "39":
                case "41":
                case "65":
                case "79":
                case "85":
                case "96":
                case "108":
                case "140":
                    comboBox3.Items.Clear();
                    ch = 13;
                    loop1(ch);
                    break;
                case "81":
                case "91":
                    comboBox3.Items.Clear();
                    ch = 16;
                    loop1(ch);
                    break;
                case "50":
                case "55":
                case "74":
                case "94":
                    comboBox3.Items.Clear();
                    ch = 23;
                    loop1(ch);
                    break;
                case "51":
                case "80":
                case "116":
                    comboBox3.Items.Clear();
                    ch = 19;
                    loop1(ch);
                    break;
                case "22":
                case "68":
                case "109":
                    comboBox3.Items.Clear();
                    ch = 31;
                    loop1(ch);
                    break;
                case "69":
                    comboBox3.Items.Clear();
                    ch = 36;
                    loop1(ch);
                    break;
                case "31":
                case "71":
                case "139":
                    comboBox3.Items.Clear();
                    ch = 31;
                    loop1(ch);
                    break;
                case "35":
                case "73":
                case "102":
                    comboBox3.Items.Clear();
                    ch = 28;
                    loop1(ch);
                    break;
                case "78":
                    comboBox3.Items.Clear();
                    ch = 72;
                    loop1(ch);
                    break;
                case "89":
                    comboBox3.Items.Clear();
                    ch = 52;
                    loop1(ch);
                    break;
                case "37":
                    comboBox3.Items.Clear();
                    ch = 40;
                    loop1(ch);
                    break;
                case "104":
                    comboBox3.Items.Clear();
                    ch = 35;
                    loop1(ch);
                    break;
                case "105":
                    comboBox3.Items.Clear();
                    ch = 45;
                    loop1(ch);
                    break;
                case "106":
                    comboBox3.Items.Clear();
                    ch = 48;
                    loop1(ch);
                    break;
                case "107":
                    comboBox3.Items.Clear();
                    ch = 43;
                    loop1(ch);
                    break;
                case "117":
                    comboBox3.Items.Clear();
                    ch = 2;
                    loop1(ch);
                    break;
                case "118":
                    comboBox3.Items.Clear();
                    ch = 29;
                    loop1(ch);
                    break;
                case "119":
                    comboBox3.Items.Clear();
                    ch = 176;
                    loop1(ch);
                    break;
                case "123":
                    comboBox3.Items.Clear();
                    ch = 4;
                    loop1(ch);
                    break;
                case "131":
                case "133":
                case "134":
                    comboBox3.Items.Clear();
                    ch = 3;
                    loop1(ch);
                    break;
                case "135":
                case "145":
                    comboBox3.Items.Clear();
                    ch = 21;
                    loop1(ch);
                    break;
                case "44":
                case "136":
                    comboBox3.Items.Clear();
                    ch = 26;
                    loop1(ch);
                    break;
               
                    
                
                
                    

            }
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
           comboBox1.Items.Add("Psalms");
        }
    }
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend