Click here to Skip to main content
15,886,728 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to open File using System.Diagnostics.Start in the Base Root directory Pin
Dave Kreskowiak8-May-12 13:15
mveDave Kreskowiak8-May-12 13:15 
AnswerRe: How to open File using System.Diagnostics.Start in the Base Root directory Pin
Luc Pattyn8-May-12 14:07
sitebuilderLuc Pattyn8-May-12 14:07 
GeneralRe: How to open File using System.Diagnostics.Start in the Base Root directory Pin
nassimnastaran9-May-12 4:46
nassimnastaran9-May-12 4:46 
QuestionC# forms Pin
Member 89392888-May-12 2:21
Member 89392888-May-12 2:21 
AnswerRe: C# forms Pin
Pete O'Hanlon8-May-12 2:29
mvePete O'Hanlon8-May-12 2:29 
AnswerRe: C# forms Pin
Tim Groven8-May-12 5:58
Tim Groven8-May-12 5:58 
AnswerRe: C# forms Pin
Reegan Durai.m8-May-12 19:16
Reegan Durai.m8-May-12 19:16 
QuestionC# dice program (combobox selection) Pin
Angel_788-May-12 1:19
Angel_788-May-12 1:19 
Been stuck with this for too long now and thought I ask for help. From reading a bunch of threads this seems trivial for you guys. I am not on some homework, just doing it out of self interest following a tutorial at csharpskolan.se

I do know how to make a windows form to generate a number using two numericUpDown boxes but I though I try make a dice program and pick the number of sides out of a comboBox. I have added 3 sided dice, 4 sided dice and so on using the design mode but I do not know how to put the value (1, 4) to the 3 sided dice selection for example.

Feels like I am getting stuck making the method, to call it depending on how many times I want to roll the 3 sided dice. I am going to have the output to a richTextBox.

What I am using is a comboBox(dice sides), textBox(number of times to roll), richTextBox(to diplay the value) and a button to generate it.

This is what I got after redoing it so many times.
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 Dice
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            richTextBox1.Clear();
            // Initiate class
            var random = new RollDice();
            // Call method

        }
    }
    public class RollDice
    {
        public int RandomDice(Int32 numberOfSides, Int32 numberOfTimes)
        {
            Random rndGen = new Random();

            for (int i = 0; i < numberOfSides; i++);

            int randomT3;
            int randomT4;
            int randomT5;
            int randomT6;

            randomT3 = rndGen.Next(1, 4);
            randomT4 = rndGen.Next(1, 5);
            randomT5 = rndGen.Next(1, 6);
            randomT6 = rndGen.Next(1, 7);
        }
                
        
    }
}


modified 8-May-12 8:35am.

AnswerRe: C# dice program (combobox selection) Pin
Jeremy Hutchinson8-May-12 3:01
professionalJeremy Hutchinson8-May-12 3:01 
GeneralRe: C# dice program (combobox selection) Pin
Angel_788-May-12 3:37
Angel_788-May-12 3:37 
GeneralRe: C# dice program (combobox selection) Pin
BobJanova8-May-12 4:38
BobJanova8-May-12 4:38 
AnswerRe: C# dice program (combobox selection) Pin
PIEBALDconsult8-May-12 3:12
mvePIEBALDconsult8-May-12 3:12 
GeneralRe: C# dice program (combobox selection) Pin
Angel_788-May-12 3:50
Angel_788-May-12 3:50 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult8-May-12 18:39
mvePIEBALDconsult8-May-12 18:39 
GeneralRe: C# dice program (combobox selection) Pin
Angel_789-May-12 2:55
Angel_789-May-12 2:55 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult9-May-12 3:20
mvePIEBALDconsult9-May-12 3:20 
GeneralRe: C# dice program (combobox selection) Pin
Angel_789-May-12 5:53
Angel_789-May-12 5:53 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult10-May-12 3:09
mvePIEBALDconsult10-May-12 3:09 
GeneralRe: C# dice program (combobox selection) Pin
Angel_7810-May-12 6:07
Angel_7810-May-12 6:07 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult10-May-12 15:48
mvePIEBALDconsult10-May-12 15:48 
GeneralRe: C# dice program (combobox selection) Pin
Angel_7811-May-12 15:57
Angel_7811-May-12 15:57 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult12-May-12 6:23
mvePIEBALDconsult12-May-12 6:23 
GeneralRe: C# dice program (combobox selection) Pin
Angel_7812-May-12 12:12
Angel_7812-May-12 12:12 
GeneralRe: C# dice program (combobox selection) Pin
PIEBALDconsult13-May-12 5:31
mvePIEBALDconsult13-May-12 5:31 
GeneralRe: C# dice program (combobox selection) Pin
Angel_7813-May-12 10:09
Angel_7813-May-12 10:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.