1,469 Posted Topics

Member Avatar for bahed121

Check out this code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp"; // Allow the user to select multiple images. open.Multiselect = true; open.Title = …

Member Avatar for bahed121
0
181
Member Avatar for ashley11

ddanbe: my car has some problems too. But I am really not sure what to do now... PS: I will stop answering on these kind of not-even-half-explined-threads.

Member Avatar for ashley11
0
123
Member Avatar for Behseini
Member Avatar for jay_el_em

This is not a good way to close the form. You better do a loop of all forms, and then check which you want to select. Selected put into an array (pre-created), and when the code goes throught the loop (when it ends), go through the array of forms, and …

Member Avatar for jay_el_em
0
167
Member Avatar for samp4ever

Try it this way: [CODE] private void button1_Click(object sender, EventArgs e) { Label l = new Label(); l.Location = new Point(100, 100); l.Text = "This is a text"; this.Controls.Add(l); } [/CODE]

Member Avatar for ddanbe
0
177
Member Avatar for james6754

Here is some simple example how to use form and class: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); string value = "ABC"; NewClass nc = new NewClass(value); nc.MyMethod(); } } public class NewClass { string classVariable; public NewClass(string parameter) { //constructor! string methodVariable = parameter; …

Member Avatar for abelLazm
0
99
Member Avatar for Kath_Fish

Check this out: [CODE] string value = "212132134214"; char[] array = value.ToCharArray(); StringBuilder sb = new StringBuilder(); foreach (char str in array) sb.AppendLine(str.ToString()); MessageBox.Show(sb.ToString()); [/CODE]

Member Avatar for Momerath
0
91
Member Avatar for ashley11

This how: [CODE] string a = "1 2 : 3"; string b = a.Replace(":", ""); //removes : string[] split = b.Split(' '); //splits to 3 characters [/CODE] Mitja

Member Avatar for CsharpChico
0
576
Member Avatar for leo88

Check this example: [CODE] string[] array1 = { "12345", "145", "1345" }; string second= "23"; int sum = 0; foreach (string item in array1) { if (item.Contains(second)) sum++; } MessageBox.Show("There is/are " + sum + " strings of \"" + second + "\" string in the array."); [/CODE]

Member Avatar for leo88
0
101
Member Avatar for lightshift

What you have to do is to select that quantity field and subtract 5. When you will select the value, you then have to do an update over that field with the new value (Field = Field -5).

Member Avatar for lightshift
0
215
Member Avatar for ashley11

Check this example: [CODE] ArrayList aList = new ArrayList(); aList.Add("1 2"); aList.Add("2 1"); aList.Add("2 3 1"); aList.Add("2 4 1 3"); ArrayList aListNew = new ArrayList(); //you have to create a new array list, because you cannot modify the list in the loop! foreach(string item in aList) { //creating a int …

Member Avatar for ashley11
0
73
Member Avatar for babbu

You some boolan flag. Like this: [CODE] bool bChecking; void textBox1_Leave() { if (!bChecking) { //put your code in the event in here! } } void YourCurrentMethod() { //do some code, which you want to do, and which fires Leave event of textBox! //just before the code fires the Leave …

Member Avatar for Mitja Bonca
0
80
Member Avatar for Suzie999
Member Avatar for Suzie999
0
120
Member Avatar for apanimesh061

[QUOTE=apanimesh061;1522790][CODE] using system; public class Hello{ public static void main(){ console.WriteLine("Hello C# World :)"); } } [/CODE] [/QUOTE] Maybe the problem lies in the "console" keyword (Console class) because it is written wth small initial. You have to write it with a big initial, like "Console". This works: [CODE] using …

Member Avatar for ddanbe
0
183
Member Avatar for Falcon25

Simple: Constructor is only a method, which has this previlege that is called first when a new instance of a class (or form) is created. It is called automatically when this instance gets created.

Member Avatar for Falcon25
0
79
Member Avatar for leo88
Member Avatar for vivekagrawal
Member Avatar for vivekagrawal
0
132
Member Avatar for Farhad.idrees

[CODE]comboBox1.Text //an example code: comboBox1.Items.AddRange(new string[] { "item 1", "item 2", "item 3" }); comboBox1.Text = "Select date"; [/CODE] property will do it ones again! But I would like to ask you how do you populate data into comboBox?

Member Avatar for Farhad.idrees
0
177
Member Avatar for vivekagrawal

do: [CODE] //in button click event: listBox1.Item.Add(textBox1.Text); [/CODE] and for setting the text to other controls you do: [CODE] private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { radioButton1.Text = listBox1.SelectedItem.ToString(); textBox1.Text = listBox1.SelectedItem.ToString(); //and so on.. } [/CODE]

Member Avatar for vivekagrawal
0
121
Member Avatar for sureshprg

Wi, would you mind showing us the code, so we can see if there is something wrong with it? thx

Member Avatar for ddanbe
0
103
Member Avatar for KasunL

C# Database programming: [url]http://www.amazon.com/Mastering-Database-Programming-Jason-Price/dp/0782141838[/url]

Member Avatar for techturtle
0
111
Member Avatar for anish99virgo

Get the states based on selected country to populate comboBox2: [CODE] private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { SqlDataAdapter da1 = new SqlDataAdapter("select State from States where country_name='" + combobox1.SelectedItem.ToString() + "'", "Data Source=.;Initial Catalog=master;Integrated Security=True;"); da1.Fill(ds1); int i = ds1.Tables[1].Rows.Count; for (int s = 0; s < i; s++) …

Member Avatar for anish99virgo
0
89
Member Avatar for leo88

hmmm... Comset2 is what? Where do you inizialize it? What kind of collection is it?

Member Avatar for leo88
0
141
Member Avatar for ppatryk

Wrong. You have to put a property of a textbox control on the end of it to check it: [CODE] if(textBox.Text != String.Empty) { //not empty (not null, even empty and null are not the same things) } else { //empty! }[/CODE]

Member Avatar for gusano79
0
246
Member Avatar for leo88

You didnt even set the min value until here. It is still 0 (or not even that, because you didnt initialize it). So you cannot compare it (if(v > min)!

Member Avatar for leo88
0
146
Member Avatar for Jessurider

Use have to to sqlExecuteNonQuery() method to exectute an insertion. [CODE] sq1 = "insert into [" + Box1.Text + "] values('" + accid.Text + "', '" + pass.Text + "', '" + sex.Text + "', '" + email.Text + "')"; cmd = new SqlCommand(sq1, cn); cmd.ExecuteNonQuery(); //HERE! [/CODE]

Member Avatar for Mitja Bonca
0
165
Member Avatar for vivekagrawal

use: [CODE] if(this.comboBox1.SelectedIndex > -1) { this.comboBox1.Selecteditem.ToString(); //or: this.comboBox1.Text; //or: this.comboBox1.GetItemText(this.comboBox1.SelectedItem); } [/CODE] one of these it should get the selected item

Member Avatar for Mitja Bonca
0
78
Member Avatar for vivekagrawal

[CODE] if (DialogResult.Yes == MessageBox.Show("Do you want to save into a database?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { //SAVE into database } else { //not saving! then you dont even need this else (you can erase it if you dont need it } [/CODE]

Member Avatar for Mitja Bonca
0
98
Member Avatar for Jessurider

YOu forgot to include ' ' to the query around property textbox.Text). Your create query has to look like: [CODE] sq1 = "CREATE TABLE '" + TextBox1.Text + "'(myId INTEGER CONSTRAINT PKeyMyId PRIMARY KEY," +"myName CHAR(50), myAddress CHAR(255), myBalance FLOAT)"; [/CODE]

Member Avatar for Jessurider
0
225
Member Avatar for Kath_Fish

[QUOTE=Kath_Fish;1513709] set of data in text file 1 2 1 3 1 4 [COLOR="red"]2 3[/COLOR] 3 4 Now, i wan to read each item and count the frequency for each item. ITEM FREQUENCY 1 contain 3 2 contain 2 3 contain 3 4 contain 2[/QUOTE] Where did you get this …

Member Avatar for Mitja Bonca
0
199
Member Avatar for Kath_Fish

Would you please stop with the threads names as "Help,,!!". This is getting us no where. And please, stop posting double or even more same posts. All aobut these numbers. Create one thread and hold to it!! I have answered on a couple of your threads, but NONE has been …

Member Avatar for Mitja Bonca
0
94
Member Avatar for vivekagrawal
Member Avatar for leo88

[QUOTE=leo88;1518686] The listbox content is as below: {1 2} 4 {1 4} 6 {1 5} 7 {1 3 4} 8[/QUOTE] 1st column is what is in the brackets? And the value out of brackets is your 2nd column, which would be the Value of the dictionary?

Member Avatar for Mitja Bonca
0
180
Member Avatar for Freedom*

Where do you initialite a new instance of a class Student? NoWhere. For to do it so, you have to create a local variable of a class: [CODE]Student st1 = new Student(); //s1 is now a reference of a class.[/CODE] for beginining...

Member Avatar for Freedom*
0
111
Member Avatar for vivekagrawal

Check out this code: [CODE] //form1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(this); f2.Show(); } public void GetDataFromForm2(List<object> list) { textBox1.Text = list[0].ToString(); textBox2.Text = list[1].ToString(); } } //form2: public partial class Form2 …

Member Avatar for vivekagrawal
0
336
Member Avatar for Arjun_Sarankulu

It has to written like this: [CODE] cmd.CommandText = "select employee_code from MST_Employee where employee_code = '" + emp_code + "';[/CODE] Mitja

Member Avatar for Arjun_Sarankulu
0
130
Member Avatar for goldeneagle217

You ca ndo it this way: [CODE] //form1: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form3 f3 = new Form3(); Form2 f2 = new Form2(f3); f2.Show(); } } //form2: public partial class Form2 : Form { Form3 f3; …

Member Avatar for goldeneagle217
0
123
Member Avatar for salmap

Try this code: [CODE] int total = 0; foreach (DataGridViewRow row1 in dgv1.Rows) { foreach (DataGridViewRow row2 in dgv2.Rows) { if (row1.Index == row2.Index) { total += (int)row1.Cells[0].Value * (int)row2.Cells[0].Value; break; } } } //when code leaves these two loops (so comes here), the "total" local variable holds the result …

Member Avatar for salmap
0
130
Member Avatar for leo88

maybe a bit off topic.. Momerath: ... StringBuilder!!! :) dont use any array, or "appanding" a text to a text, like myString +=something! :) I have learned that now.

Member Avatar for Mitja Bonca
0
2K
Member Avatar for Kath_Fish

Mate, if this is not you final version of the project, I wont even help you out. That it wont be like last time, when I did the code for you (school homework I guess), and then you came out later to ungrade it. No, cant do. So, what is …

Member Avatar for Mitja Bonca
0
134
Member Avatar for zachattack05

Depents what type are these different versions. If they are both numbers you can use: ==, >=, <=, >, < (all of them). If they are a string you cannot use any. Becuase it will simply not work. YOu cannot compare the difference in the string, you can only compare …

Member Avatar for zachattack05
0
79
Member Avatar for narendera22

Read here: [url]http://www.codeproject.com/KB/database/DotnetDb2.aspx[/url]

Member Avatar for Mitja Bonca
0
116
Member Avatar for ajinkya112

You have an error on row No.20. It should be like this: [CODE]dateTimePicker1.Value = Convert.ToDatetime(drr["BILL DATED"]);[/CODE]

Member Avatar for Mitja Bonca
0
143
Member Avatar for krii017

You want to do an sql query which would return all the order numbers, which contains the inserted number in textBox? The order is not counting at all? I can see you typed into a textBox 10078, and the return was 2 results: 1007851103 and 11007859. 2nd order number has …

Member Avatar for krii017
0
160
Member Avatar for ashley11

And what would you like to know? Only if they are equal? Or to the the same values back (or to get the vlaues which are not in both array)? Mitja

Member Avatar for ashley11
0
95
Member Avatar for leo88

Impossibe in these kind of collections. You cannot store type string into type of variable. What do I mean: your 1st array has the string as for a key, and 2nd array`s Value is the double. Chanage that. Then you simply code the key from array1 to the value of …

Member Avatar for leo88
0
97
Member Avatar for hypeh

Hi, you have to create a new Form. Create a method which would start the searching. Before search begins, start a new thread (so the main one will not be busy while searching). Then create a progressBar, which would show the progress (loading bar). Somehow you have to figue out …

Member Avatar for Mitja Bonca
0
113
Member Avatar for shyla

Please remember shyla, one question per thread. MArk this one as salved (vote as useful to those guys who answered on your question), and mark the whole thread as answered.! Remember, ONE question per thread. Bye

Member Avatar for shyla
0
88
Member Avatar for orim0109

In here: [CODE] using (TextReader rdr = new StreamReader(@"C:\"text.txt")) { //code in here } [/CODE]

Member Avatar for orim0109
0
70
Member Avatar for nera1981

The End.