1,469 Posted Topics

Member Avatar for revjim44

[QUOTE=Momerath;1479549]Instead of creating a new class and methods to fill the class we can use LINQ to do that for us: [code]var allItems = item.Zip(location, (i, l) => new {Item = i, Location = l});[/code][/QUOTE] Interesting... but there is some code missing. Would you mind showing it all? I mean, …

Member Avatar for Momerath
0
131
Member Avatar for Phil++

For login ordinary we have userName and password. So for checking if user exist in the database you only chack for these 2 parameters. So: [CODE] SELECT UserName, Password FROM Users WHERE UserName = 'textBoxUserName.Text' [/CODE] Now you open an sqlDataReader which wil check if the userName exists. If exists …

Member Avatar for Phil++
0
86
Member Avatar for benjie987
Member Avatar for Momerath
0
307
Member Avatar for AngelicOne

1st: you code of selected item is incorect, you have to check for "Selected" property, not "Checked". Checked property is especially used for checkBoxes.

Member Avatar for Mitja Bonca
0
5K
Member Avatar for AngelicOne

This how: [CODE] public partial class Form1 : Form { List<string> listNames; public Form1() { InitializeComponent(); //some example data to populare dgv: dataGridView1.Columns.Add("col1", "name"); dataGridView1.Columns.Add("col2", "age"); dataGridView1.Rows.Add("mitja", "31"); dataGridView1.Rows.Add("john", "28"); dataGridView1.Rows.Add("sara", "22"); } private void button1_Click(object sender, EventArgs e) { listNames = new List<string>(); foreach (DataGridViewRow row in dataGridView1.Rows) { …

Member Avatar for Mitja Bonca
0
4K
Member Avatar for Zephyr-

Added to darkagn`s post... you can bind listBox control to the datasource (and tabControl as well), which hold some data (the control will get populated "automactically". Back to your question. If I understood you, You have a textBox, into which user enters some name, this name then transfers to listBox, …

Member Avatar for Mitja Bonca
0
110
Member Avatar for valter

Look at this code, it creates and erases (if exist) all labels: [CODE] Label[] label; int counter = 1; private void button1_Click(object sender, EventArgs e) { //checing if labels already arecreatred: if (label != null) ClearingLabels(); //next: creating new labels: int x = 20; int y = 20; label = …

Member Avatar for Mitja Bonca
0
192
Member Avatar for Zephyr-

Convert the value to integer, and you should have the correct value, like: [CODE] private void numericUpDown1_ValueChanged(object sender, EventArgs e) { int value = Convert.ToInt32(this.numericUpDown1.Value); }[/CODE]

Member Avatar for Mitja Bonca
0
3K
Member Avatar for AngelicOne

Hi, I guess you want to do the sql query on every character inserted, but... You missed the point of the main issue you are having. Tell me, which characters do you want to be inserted into textBox (or which not)? As far as I can see from your code …

Member Avatar for Mitja Bonca
0
166
Member Avatar for Zephyr-

Heres all you need: [CODE] private void button1_Click(object sender, EventArgs e) { //changing name and text property of the tabPage1 (of the tabContgrol1): tabPage1.Name = String.Empty; tabPage1.Text = "LOOK"; //creating new tabPage (of th tabControl1): int countPages = tabControl1.TabPages.Count; TabPage newPage = new TabPage(); newPage.Name = "tabPage" + countPages; newPage.Text …

Member Avatar for Zephyr-
0
132
Member Avatar for Mr.BunyRabit

Hi again, it would help if you would paste the code that you have in here, it will be a way easier salved. HINT: ayou said you can bind Names to the listBox, so when you want to bind "SureNames", 1st you set the dataSource to null (to clear it) …

Member Avatar for Mitja Bonca
1
453
Member Avatar for Jessurider

In form load write: [CODE]this.FormBorderStyle = FormBorderStyle.None;[/CODE]

Member Avatar for Jessurider
0
84
Member Avatar for Jessurider
Member Avatar for Mitja Bonca
0
81
Member Avatar for prayag.419

[CODE] if (db.dbRdr.Read()) { textBox1.Text = (string)dbRdr[0]; } [/CODE] YOu simply have to specify the type of tghe db`s column to the reader, and pass th value to the variable - in your case this is the control textBox1. Hope it helps, Mitja

Member Avatar for Mitja Bonca
0
110
Member Avatar for neptunethought

[URL="http://dotnetperls.com/streamwriter"]Here[/URL] you have simple examples of using StreamWriter, which is in your case by far best object to use. And [URL="http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx"]here[/URL] you can read about StreamWriter class. Its good to know which metods and properties to use with this object. Hope it helps, Mitja

Member Avatar for Mitja Bonca
0
173
Member Avatar for yousafc#

Hi, of course its possible to do games with C# -everything you can image. Here is a link to your game: [url]http://forum.codecall.net/csharp-tutorials/1804-code-c-tic-tac-toe.html[/url] Hope it helps, Mitja

Member Avatar for yousafc#
-1
213
Member Avatar for jay_el_em

Which adjacent label? The closest one on all four sites (up, down ,left and right)? Please defile which one the code needs to check Precisly. Mitja

Member Avatar for Mitja Bonca
0
146
Member Avatar for AngelicOne
Member Avatar for Mitja Bonca
0
62
Member Avatar for Phil++

hmm, you have to specify the full path to the database, like: [CODE] string connString = "Data Source=localhost; Database=C:\MyFolder\MyProject\Database1.mdf; User ID=root; Password=root"; [/CODE] If not, you can use instead of a full path, implicit path: "|DataDirectory|\.Database1.mdf"

Member Avatar for Momerath
0
87
Member Avatar for kukuruku

As said, its the same thing. but I would go for 1st choice. Why? Simply because its better looking, and easier for recognizing parameters. But its up to you which one you will pick. Mitja

Member Avatar for Mitja Bonca
0
126
Member Avatar for carlitosway17

You want to create 20 centances. is there any pre-defined order of the array? I mean has to code pick one item from 1st array, then one item from 2nd array, one item from 3rd array and one item from 4th array? Or can be custom?

Member Avatar for carlitosway17
0
6K
Member Avatar for nadav64

This might help. I put the code into a button click event, you can put it anywhere you want to: [CODE] private void button1_Click(object sender, EventArgs e) { //test code: textBox1.Text = "only girl"; textBox2.Text = "rihanna"; //your code: string webAddress = "http://www.youtube.com/results?search_query="; TextBox[] tb = new TextBox[] { textBox1, …

Member Avatar for Mitja Bonca
0
159
Member Avatar for carlitosway17

You can do it like this: [CODE] int[] array = new int[25]; Random random = new Random(); // insert 25 random integers from 0-99 in tree for ( int i = 0; i < 25; i++ ) { int value = random.Next(0,101); array[i] = value; } //sort in ascending order: …

Member Avatar for carlitosway17
0
2K
Member Avatar for aaron385

Do you already have create database in Sql Server? Which sql server will you be using exactly?

Member Avatar for Momerath
0
320
Member Avatar for Michael27

You want that user write number by number (one per each time) and the app. should create an array?

Member Avatar for Mitja Bonca
0
135
Member Avatar for Phil++

What do you means with using SQL? Sql has nothing do to with programming. Its only meant for saving some data, which can be retreived and processed by the program. But not with sql. Sql is so called dataBase to which you can approach with many kind of quieries (select, …

Member Avatar for Mitja Bonca
0
113
Member Avatar for ChrisHunter

Here is an example, that might help: [CODE] 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 Feb17Exercise { public partial class Form1 : Form { public Form1() { InitializeComponent(); // Create the customer object we want to display Customer bill = …

Member Avatar for lolafuertes
0
564
Member Avatar for aaronmk2

In foreach loop: [CODE] List<RangeChecker> range = new List<RangeChecker>(); //then you fill the list! for(int i = 1; i< 5; i++) { RangeChecker rr = new RangeChecker(); //i will insert some example data rr.Meter = i; rr.Yard = (i*0.9) range.Add(rr); } //read out of it: foreach(RangeChecker rc in range) { …

Member Avatar for Mitja Bonca
0
135
Member Avatar for Phil++

No. So open that form2. We cannot know which one is that your "login Form", can we?

Member Avatar for Phil++
0
138
Member Avatar for carlitosway17

And where do you instantiate the object, like: TBinarySTree bt; ? You can create a new instance of an object on two ways: [CODE] namespace ConsoleApplication1 { class MyClass { //1. in the class: BinarySTree bt = new TBinarySTree(); //2.In the method BinarySTree bt; private void MyMethod() { bt = …

Member Avatar for Mitja Bonca
0
3K
Member Avatar for happyandrea

This should do it: [CODE] //on form1: Form2 f2 = new Form2(this); form2.Show(); //create a method and a label on Form1 //to pass data from form2 to form1; public void MyMethod(string value) { Label lablel1 = new Label1; label1.Location = new Point(10,10); this.Controls.Add(label1); label1.Text = value; } //on form2: //constructor …

Member Avatar for Mitja Bonca
0
3K
Member Avatar for Mr.BunyRabit

This should do it: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); string[] array ={"A", "B", "C", "D", "E"}; listBox1.DataSource = array; listBox1.SelectedIndex = -1; listBox1.SelectedIndexChanged+=new EventHandler(listBox1_SelectedIndexChanged); } private void button1_Click(object sender, EventArgs e) { //1. automatic selection - insert the number of the index into …

Member Avatar for Mitja Bonca
0
124
Member Avatar for DeathEater

[QUOTE=DeathEater;1472612]hi, i'm having a bit of trouble with grid views. see i can show stuff in them but i want to manipulate and use a certain selected record or field in it ( e.g : delete it from table in the DB or copy it into a textbox.). i'll be …

Member Avatar for Mitja Bonca
0
81
Member Avatar for aaronmk2

This should work: [CODE] public enum Options { newZ = 1, display, Exit } void Method2() { string volString = "1"; Options options = (Options)Enum.Parse(typeof(Options), volString); switch (options) { case Options.newZ: { break; } } } [/CODE]

Member Avatar for Mitja Bonca
0
118
Member Avatar for raizor89

This is partly true (decimals will not go through, while negative integers will go): [CODE] try { numberToFactoral = int32.parse(textbox1.text); } catch { label1.text = "please input positive whole number"; return; } [/CODE] If the user will enter "-1" will go through try block. Because its -1 is still a …

Member Avatar for ddanbe
0
1K
Member Avatar for yousafc#

Convert strings into integers and then do the comparison: [CODE] int intValueA = Convert.ToInt32(txtMath.Text); if (ibtValueA >= 80)[/CODE]

Member Avatar for ddanbe
0
90
Member Avatar for micmo

Can you point me to the row where is comes to the error? Its hard to look in such a code, which has so many custom objects - it will take a lot of time to figure out what all you have there. thx Mitja

Member Avatar for micmo
0
1K
Member Avatar for revjim44

So you have 2 comboBoxes. 1st is bound to dataSource and 2nd comboBox is populated with some values, regarding on comboBox1 selection. Which values are these, what is seatNumber variable? Can you please provide some more code? thx mitja

Member Avatar for revjim44
0
261
Member Avatar for xxxtian

Do you have to save only names of th checkBoxes? or What exactly? And where? Do you need a new ID (primary key) for each checklistBox? How does your storedProcedure look like (it only accepty one value at a time, or..)? If its in any help: [CODE] private void GetCheckedItems() …

Member Avatar for xxxtian
0
1K
Member Avatar for stefilina

Apparently you add data to dgv control from textBoxes. Every time you insert something into textBoxes, these data (2) have to insert into a new row in dgv. This is how you do it: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); dataGridView1.Columns.Add("col1", "column 1"); dataGridView1.Columns.Add("col2", …

Member Avatar for Mitja Bonca
0
87
Member Avatar for nilbernator

What exactly would you like to do? BTW: there are two sentances in the upper xml code. Which one?

Member Avatar for nilbernator
0
148
Member Avatar for AngelicOne

Can you insert 0 (zero) instead of nothing (in case if user does not insert a number)? I was thinking of using this code then: [CODE] string strValue = textBox1.Text.Trim(); int intValue = 0; if (strValue != String.Empty) intValue = Convert.ToInt32(strValue); else intValue = 0; [/CODE]

Member Avatar for Mitja Bonca
0
269
Member Avatar for AngelicOne

Is there any other control on the form, you can set its primal focus? If you can try to set the focus to the form: this.Focus();

Member Avatar for AngelicOne
0
252
Member Avatar for AngelicOne

1. You can create an array of all wanted textBoxes: [CODE] private void button1_Click(object sender, EventArgs e) { TextBox[] tb = new TextBox[] { textBox1, textBox2, textBox3, textBox4, textBox5 }; for (int i = 0; i < tb.Length; i++) tb[i].Text = String.Empty; } [/CODE]

Member Avatar for AngelicOne
0
103
Member Avatar for JDSkywalker

Where do you have defined "ShortName" property in the clsItemsNumID class? I dont see it. Do it this way: [CODE] public class clsItemsNumID { public string LongName { get; set; } public string ShortName { get; set; } public int ID { get; set; } public clsItemsNumID(int _id, string _long, …

Member Avatar for Mitja Bonca
0
659
Member Avatar for stimp80

I did the example code, and it works fine. I have created two form (form1, and form2). Instead of using dropDownList, I have used ComboBox control - its actually the same, you only change the code so it will suit to your control. Ok here it is: //form1: [CODE] public …

Member Avatar for stimp80
0
331
Member Avatar for judithSampathwa

Here you do: [CODE] 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; using System.Data.SqlClient; namespace Feb153TyperArch { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { BLL bll = new BLL(); List<Customer> …

Member Avatar for Mitja Bonca
0
324
Member Avatar for AngelicOne

[QUOTE=AngelicOne;1473757]..., but the selection doesn't change from date picker only! I need an object that I can be able to choose both date and time.[/QUOTE] Can you please elaborate this issue a bit precisly? and this works: [CODE] DateTime date = dateTimePicker1.Value; string strDate = String.Format("{0:MM/dd/yy hh:mm tt}", date); [/CODE] …

Member Avatar for AngelicOne
0
93
Member Avatar for rachaelginge

Yes and? Where from, the store, from the hill or from dataBase? Please privide us some more info. I cannot know what exactly do you hae in mind. Mitja

Member Avatar for Mitja Bonca
-1
128
Member Avatar for thebigbroski

[CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Feb15StingArray { class Program { char[] alphabet = "abcdefghijklmnopqrstuvwxyz".ToCharArray(); string[] lines = System.IO.File.ReadAllLines(@"C:\1\test4.txt"); string[] parts = null; static void Main(string[] args) { Program one = new Program(); one.splitData(); one.run(one.parts); Console.WriteLine(one.getValueForName("s")); Console.WriteLine("Press any key to exit."); System.Console.ReadKey(); } public void run(string[] …

Member Avatar for Mitja Bonca
0
505

The End.