castajiz_2 35 Posting Whiz

Instead of

 where (dtCutOffDate.Subtract(dt.Field<DateTime>("Date")).Days) >= iStartRange
                 && dtCutOffDate.Subtract(dt.Field<DateTime>("Date")).Days <= iEndRange

Just add a '?' character.

 where (dtCutOffDate.Subtract(dt.Field<DateTime?>("Date")).Days) >= iStartRange
                 && dtCutOffDate.Subtract(dt.Field<DateTime?>("Date")).Days <= iEndRange

You should avoid the exception now.

castajiz_2 35 Posting Whiz

I'm sure You will figure it out with in depth given explanation. Have an attempt and then if you are still not sure and if you still get errors, come back with the piece of code instead of entire class and help will be surely given to you.

castajiz_2 35 Posting Whiz
  1. Error--> I do not see a method called IsString
    2- Error--> Method IsWithinRange accepts only four arguments so you have to assign 4 arguments once you call your method, not six as you did it.
    3- Error--> if you have a method that is NOT void then you have to specify the return keyword! so I suggest to put some return keywords inside your Calculation method.
castajiz_2 35 Posting Whiz

I'm sorry I thought that you have a database involved. Just use a for loop and inside your for loop check if the id matches the user-input, if it does then print out the information or whatever you want to show to user.

for(int i=0; i < Oeuvres.Length ;i++)
{
   if(nb_element==your_id)
   {
      Console.WriteLine("Info");
   }
}  
castajiz_2 35 Posting Whiz

Well convert it then, I don't see where the problem is. Once you are done with the conversion, use that same variable (converted) to pass it into your query. You have plenty of examples online, one of them:http://www.dotnetperls.com/sqlparameter
when you attempt something, then post your code here if you run into trouble.

castajiz_2 35 Posting Whiz

have a look at this:
Click Here

castajiz_2 35 Posting Whiz

This shouldn t be too hard to do. Altough I m not sure what do you have to do in the end. Do you have to have the html in your PDF with the tags included or is it just the output of your html that you have to have in your PDF?.
Have a look at this link to get you started
Click Here
and type itextsharp into youtube to see how it works in action.

castajiz_2 35 Posting Whiz

This is a solution on how you could solve you problem, I m again working in java a little bit so I m trying to get the syntax to my brain so I hope that people won't get mad for posting the solution...

public class Solution
{

    public static void main(String[] args) 
    {
      Scanner sc=new Scanner(System.in);
        String concat="";
        String input = sc.nextLine();
        char [] array=input.toCharArray();
        for(int i =0;i<array.length;i++)
        {
            int z=(int)array[i];
            String binary=decToBin(z);
            concat=concat+CheckNumbersOfDigits(binary);
            concat+="-";

        }
       out.println(removeLastChar(concat));
    }
    private static String CheckNumbersOfDigits(String digit) 
    {

        int diglen=digit.length();
        int add_dig=8-diglen;
        for(int i=0;i<add_dig;i++)
        {
            digit="0"+digit;
        }
        return digit;
    }
    public static String decToBin(int dec) 
    {
        if (dec == 0) {
            return "0"; // special case
        }

        final StringBuilder result = new StringBuilder();
        int current = dec;

        while (current != 0) {
            result.append(current & 0x1);
            current = current >> 1;
        }

        return result.reverse().toString();
    }
    private static String removeLastChar(String str) {
        return str.substring(0,str.length()-1);
    }

 }
castajiz_2 35 Posting Whiz

Watch videos 46, and 47, and you ll understand.
Click Here

castajiz_2 35 Posting Whiz
listBox1.Items.Clear(); // for removing all items



   foreach(ListItem listItem in listBox1.Items) /* adding items to another listbox*/
    {
       if (listItem.Selected == True)
       {
          listBox2.Items.Add(listItem);
       }
    }
castajiz_2 35 Posting Whiz
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication14
{
    public class Grades
    {
        public static void Main(string[] args)
        {
            int[][] grades;
            grades = new int[3][];
            grades[0] = new int[3];
            grades[1] = new int[2];
            grades[2] = new int[4];
            for (int i = 0; i < grades[0].Length; i++)
            {
                Console.WriteLine("Please input grade for first course followed by enter: ");
                grades[0][i] = Convert.ToInt32(Console.ReadLine());
            }
            Console.WriteLine();
            for (int i = 0; i < grades[1].Length; i++)
            {
                Console.WriteLine("Please input grade for second course followed by enter: ");
                grades[1][i] = Convert.ToInt32(Console.ReadLine());
            }
            for (int i = 0; i < grades[2].Length; i++)
            {
                Console.WriteLine("Please input grade for third course followed by enter: ");
                grades[2][i] = Convert.ToInt32(Console.ReadLine());
            }
            Console.Write("The grades for the first course are: {0}, {1}, and {2}", grades[0][0], grades[0][1], grades[0][2]);
            Console.WriteLine();
            Console.Write("The grades for the second course are: {0} and {1}", grades[1][0], grades[1][1]);
            Console.WriteLine();
            Console.Write("The grades for the third course are: {0}, {1}, {2}, and {3}", grades[2][0], grades[2][1], grades[2][2], grades[2][3]);
            Console.ReadKey();
        } // end Main
    } // end class Grades
}
castajiz_2 35 Posting Whiz

Well i don't know the exact definition of a bug altough i should know but if he doesn't consider that as a bug then it is not a bug...

@lithium112 --> try this code and your previous code and you will see the difference

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GunSimulation
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Press Spacebar to fire the gun. You start with 8 bullets in the mag.\n");
            int i = 8;
            while (true)
            {
                 ConsoleKeyInfo info = Console.ReadKey();
                if (info.Key == ConsoleKey.Spacebar)
                {
                    if (i > 0)
                    {
                        if (i <= 1)
                        {
                            Console.WriteLine("\nYou have 0 bullets in your pistol! Hit 'r' to reload!\n");
                            Console.WriteLine("All you hear is a click.\n");
                        }
                        else
                        {
                            i = i - 1;
                            Console.WriteLine("\nYou now have {0} bullets in your mag.\n", i);
                        }

                    }

                }

                if (info.Key == ConsoleKey.R)
                {
                    i = 8;
                    Console.WriteLine("\nYou now have 8 bullets in your mag.\n");
                }
            }
        }
    }
}
castajiz_2 35 Posting Whiz

The problem is the mutliple readkey() method call, you have to have a storage for you readkey()...
try this

static void Main(string[] args)
        {
            Console.WriteLine("Press Spacebar to fire the gun. You start with 8 bullets in the mag.\n");
            int i = 8;
            while (true)

            {
                ConsoleKeyInfo info = Console.ReadKey();
                if (info.Key==ConsoleKey.Spacebar)
                {
                    i = i - 1;
                    Console.WriteLine("\nYou now have {0} bullets in the barrel.\n", i);
                }
                if (i == 0)
                {
                    Console.WriteLine("\nYou have 0 bullets in your pistol! Hit 'r' to reload!\n");
                    Console.WriteLine("All you hear is a click.\n");
                }
                if (info.Key == ConsoleKey.R)
                {
                    i = 8;
                    Console.WriteLine("You now have 8 bullets in your mag.");
                }
            }
        }
lithium112 commented: Great Solution +0
castajiz_2 35 Posting Whiz

Post some code of your's...

castajiz_2 35 Posting Whiz

What do you mean exactly when you say 'if the thext was an item' what else could it be in your case?

castajiz_2 35 Posting Whiz

Hmmm... I really don t know i m looking at the code and everything seems ok but maybe i missed something, anyways since your code is not long press f11 and go through every line and see what happens that is the only thing that i can say. Provide more information in your next post if possible and tomorrow if you don't solve the problem i ll rewrite your code a bit a post it here...

castajiz_2 35 Posting Whiz

Dont want to sound too smart here but it's the same as the output from the MessageBox.Show(string) you must have a string output otherwise you'll get an error ...

For your other part I would just go and convert each element to a string

 comboBox6.Items.AddRange(new int[]{1,2,3,4,5}.Select(x=>x.ToString()).ToArray());

Afters you could just convert these string to int's depending what you want to do with it...

castajiz_2 35 Posting Whiz
string sql = "INSERT INTO STU(EID,FIRST_NAME,LAST_NAME,IMAGE)VALUES(" + textBox1.Text + "," + textBox2.Text + "," + textBox3.Text + ",@img)";
                if (cn.State != ConnectionState.Open)
                    cn.Open();
                command = new SqlCommand(sql, cn);
                command.Parameters.Add(new SqlParameter("@img", img));

On line 5 remove the monkey sign(@), on line 2 (line one but second row) look where you comma is ",@img", remove the comma concatenate it separetly, try then and tell if errors appear. Try not to use the concatention it's messy and not a good practice since it's vulnerable once your database is ready to use...

castajiz_2 35 Posting Whiz

you will have to use another logic for you program. altough your logic is good at first if you lower your triangle (if you reduce the number of rows) then you 'll see that your solution isn't good
Click Here

for instance:

        5
       1 2
      9 4 5
     9 7 6 12
   11 2 33 4 5

following your code you would do this:
5+2+5+12+5=29--> final result
but have in my mind that there are other routes as well

for instance:
take the most left route and go down
--> 5+1+9+9+11=35
35>29 --> that is your solution isn't 100% correct

ddanbe commented: Keep up the good work! +15
castajiz_2 35 Posting Whiz

try this then:
`

 class Program
    {
        static void Main(string[] args)
        {
            cars.color = "blue";
            cars.price = 0.2;
            cars.model = "volvo";
            cars.mark = "volvo";



            cars.WriteInfo();

            //book parameters

            Console.ReadKey();
        }
    }
}
class cars
{
    public  static string mark;
    public  static string model;
    public   static string color;
    public  static double price;

    public static  void WriteInfo()
    {
        Console.WriteLine("cars: mark: {0} model: {1}. color: {2}. price: {3}", mark, model, color, price);
    }
}

`

castajiz_2 35 Posting Whiz
class cars
{
    public  string mark;
    public  string model;
    public   string color;
    public  double price;
    public cars(string markee, string modelee, string coloree,double pricee) 
    {
        mark = markee;
        model = modelee;
        color = coloree;
        price = pricee;
    }
    public  void WriteInfo()
    {
        Console.WriteLine("cars: mark: {0} model: {1}. color: {2}. price: {3}", mark, model, color, price);
    }
}

class Program
    {
        static void Main(string[] args)
        {
            cars e1 = new cars("bmq","","",0.2);
            books e2 = new books();



            e1.WriteInfo();

            //book parameters
            e2.author = "Fyodor Dostoyevsky";
            e2.genre = "morality";
            e2.name = "The Brothers Karamazov";
            e2.price = 25;
            Console.WriteLine(e1);
            Console.ReadKey();
        }
    }

use a constructor for this SO that you can built your object, learn constructors, i ve put some silly values inside but you ll figure it out, do the rest on your own

castajiz_2 35 Posting Whiz

You arent calling the method from your class to the static vodi main()

castajiz_2 35 Posting Whiz
  viewerlist.Lines = list.ToArray();

where does this come from?

castajiz_2 35 Posting Whiz

why don t you use empty string instead of null?, and your method will always return null since is not return a variable state.

castajiz_2 35 Posting Whiz
import java.util.Random;
import java.util.Scanner;

public class DiceGame2 {
    private static Scanner input;
    public static void main(String[] args) {
        // Declare variables for Scanner and Random
        input = new Scanner(System.in);
        Random random = new Random();
        // Setup an array to hold the values from rolling one or two dice.
        // Declare a variable to hold the user's input for rolls and dice.
        // and another variable to hold the number generated by java.util.Random.
        int[] frequency = new int[6];
        int[] frequency2 = new int[6];
        int rolls;
        int dice;
        int temp;
        // Asks user how many die they would like to roll, then stores it in the variable dice.
        System.out.print("How many dice would you like to roll, 1 or 2?\n");
        dice = input.nextInt();
        if(dice == 1) {
           // Asks user for input on how many rolls they would like to make, then stores it in the variable rolls.
           System.out.print("How many times do you want to roll the dice\n");
           rolls = input.nextInt();
           // for loop to go through the number of rolls user inputs.
           for(int i = 0; i < rolls; i++) {
               temp = random.nextInt(6);
               frequency[temp]++;
           }
           // Display the number of rolls and results with a for loop.
           System.out.print("Face\tFrequency\n");
           for(int i = 0; i < 6 ; i++) {
              System.out.println(i+1 + "\t" + frequency[i]);
           }
        }else
        {
               // Asks user for input on how many rolls they would like to make, then stores it in the variable rolls.
               System.out.print("How many times do you want to roll the dice\n");
               rolls = input.nextInt(); …
castajiz_2 35 Posting Whiz

didnt you do that on your second post to this thread? Please provide new code if you ve changed your previouse code a be more specific, another thing that i can see in your code is that you re are reaching number 12 with the second dice, shouldn it be 6 again?

castajiz_2 35 Posting Whiz

I m not sure what you want but first of all PROPERTY AutoSize does not exist (using 2012 VS).However there is a property called MultiLine and if you set it to true your text(string) will go down after it reaches the border of the textbox, it will go in the second line.

castajiz_2 35 Posting Whiz

you have to concatenate, again

textBox1.Text = textBox1.Text+line;

change line 5 on your first post.

castajiz_2 35 Posting Whiz

Why don t you use the streamreader class instead and i think at line 5 you want to do this

textBox1.Text = textBox1.Text+line;

but please give some more detalis cause i m not sure what you want exactly

castajiz_2 35 Posting Whiz

nothing

castajiz_2 35 Posting Whiz
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Homework_task_F
{
    class StudentDetails //class for Declarations
    {
        public string studentname;
        public string studentsid;
        public string studentgrade;
    }
    class Students
    {
        public List<StudentDetails> studList = new List<StudentDetails>();
        //This list contains the student list
        public int MaxStudents;
          //This Function Adds the Record
        public int AddRecord(string name, string sid, string grades)
        {
            StudentDetails stud = new StudentDetails();
            stud.studentname = name;
            stud.studentsid = sid;
            stud.studentgrade = grades;
            studList.Add(stud);
            MaxStudents = studList.Count;
            return 1;
        }     
    }
    class Program
    {
        static public Students theStudents = new Students();

        //This method is to view Records as Report
        static public void ViewRecords()
        {
            Console.WriteLine("__________________________________________________________________________");
            Console.WriteLine("SNo Student Name    SID      Grade                                        ");
            Console.WriteLine("__________________________________________________________________________");
            for (int i = 0; i < theStudents.MaxStudents; i++)
            {
                Console.Write("{0, -5}", i + 1);
                Console.Write("{0, -15}", theStudents.studList[i].studentname);
                Console.Write("{0, -10}", theStudents.studList[i].studentsid);
                Console.Write("{0, -20}", theStudents.studList[i].studentgrade);
                double Grade = Convert.ToDouble(theStudents.studList[i].studentgrade);
                if (Grade >= 70 && Grade <= 100)
                {
                    Console.Write("you Pass First Class \n");
                }
                if (Grade >= 60 && Grade <= 69)
                {
                    Console.Write(" you is Pass Upper Second Class \n");
                }
                if (Grade >= 50 && Grade <= 59)
                {
                    Console.Write(" you Pass Lower Second Class \n");
                }
                if (Grade >= 40 && Grade <= 49)
                {
                    Console.Write(" you Pass 3rd Class \n");
                }
                if (Grade >= 0 && Grade <= 39)
                {
                    Console.Write(" sorry you failed \n");
                }
                if (Grade >100)
                {
                    Console.Write("Error \n");
                }
            }
            Console.WriteLine("__________________________________________________________________________");
           }
        static public void InputRecords()
        {
            Console.Write("Student Name: \n");
            string name; 
            name = Console.ReadLine();
            Console.Write("Student SID: \n"); …
castajiz_2 35 Posting Whiz

i copied and pasted your code and it s working quite OK. By saying that your code doesn t work are you reffering to the "Sorry you failed" output on the right side of the console?

castajiz_2 35 Posting Whiz

i don t know if it s too early in the morning but i really don t understand what you want. Can you please be more specific

castajiz_2 35 Posting Whiz

now i m really confused

I got 2 picturebox in my form which when I click on the 1st one I get 3 items in the listbox
i really don t understand this, what u are saying means that your image generates a list? In your first post you were talking about the inversive proccess were nt you? Please be more specific or post more code.

castajiz_2 35 Posting Whiz

Well suppose that you ve added images to the Resources and you have them already in your Listbox. You can do this by writting the folowing code:

List<Image> list;
        public Form1()
        {
            InitializeComponent();
            list = new List<Image>();
            list.Add(Properties.Resources.image1name);
            list.Add(Properties.Resources.image2name);
            list.Add(Properties.Resources.image3name);
            //and so on...


        }

        private void Form1_Load(object sender, EventArgs e)
        {

            listBox1.DataSource = list;

        }

Now that you have your Image objects in your listbox by clicking on one of them you should be able to display your image to the PictureBox by using this code.

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

                pictureBox1.Image = (Image)listBox1.SelectedItem;

        }

So you just generate the event and put the folowing code inside, You have to cast the items in the listbox otherwise you ll get an error.

ddanbe commented: good +15
castajiz_2 35 Posting Whiz

I didnt understand them either, until i found this youtube video:
Click Here

castajiz_2 35 Posting Whiz

i ve tested your code and it works, by the way put a semicolon after your last line of code altouhg i think that this is not the problem.

listBox1.Items.Add(s);
castajiz_2 35 Posting Whiz

there is an really good tutorial with all the steps on this webpage:
Click Here

timmyjoshua commented: hmmm!!! thanks, i think this should work... +0
castajiz_2 35 Posting Whiz
castajiz_2 35 Posting Whiz

Well i m not exactly sure what your goal is but if you want to display something you have to call your class! So you have to make a instance of it, for example

Employee em=new Employee(); 

and you can pass parameters to it because you created a constructor otherwise you won t have any use of it

Employee em =new Employee(value1,value2); //value1=type_int,value2=type_double

AND one other thing, before you do that be sure to insert the Namespace wich is ConsoleApplication1 by doing this

using ConsoleApplication1;

otherwise you won t be able to access your class that you creater eralier before.

castajiz_2 35 Posting Whiz

Hmm, if i understood you correctly then what you want your code to do is to find a average grade of each one of the persons stored in the list. Is that right?

castajiz_2 35 Posting Whiz

Since you did not specify which programming language you are using i ll give you this link Link Anchor Text . It s for c# and the content is very well explained.So give it a try.