1,469 Posted Topics

Member Avatar for judithSampathwa
Member Avatar for davieJohnson

I did a simple example with 2 forms. Both have textBoxes, and when clicking the button on form2, text transfers to from textBox on form2 to textBox on form1. [CODE] //form1: public partial class Form1 : Form { public Form1() { InitializeComponent(); StartMethod(); } private void StartMethod() { string strID …

Member Avatar for Mitja Bonca
0
159
Member Avatar for zahrahLand

Because, you are retreiving onyl two different values from db, you can use Directory with key (id) and value (book name). [CODE] Dictionary<int, string> list = new Dictionary<int, string>(); while (reader.Read()) { int idBook = (int)reader[0]; string nameBook = (string)reader[1]; list.Add(idBook, nameBook); } [/CODE]

Member Avatar for Mitja Bonca
0
184
Member Avatar for faintfascinatio

Sure, thats natural that you will not get any results if you stated to look for a user with all three fileds (in a where clause). If you state "... WHERE name = @name AND last = @last AND social = @social"; the query will always look for results based …

Member Avatar for Mitja Bonca
0
156
Member Avatar for judithSampathwa

Try this: [CODE] decimal moneyvalue = 1234567890.09m; string html = String.Format("{0:C}", moneyvalue); [/CODE]

Member Avatar for Mitja Bonca
0
174
Member Avatar for ssudra
Member Avatar for tom_289

You know whats the problem with your code, you can pass to the constructor of the class (partTimeEmployees) only 3 parametes, but in your switch loop "partTime", you pass them 5. You have to change them to 3, or re-edit the constructor. Mitja

Member Avatar for tom_289
0
161
Member Avatar for mastermind8

Hi, if you dont mind, you can send me whole project with the databse on my mail, I`ll take a look (I have an advantage, becuase I know your native language :) ). mailto: <<Snipped>> Mitja

Member Avatar for Mitja Bonca
0
97
Member Avatar for rikiroxs

Why would you like to transfer data from textBoxes to DataGridView, and from there to db? Or did you mean to dataTable, and from here to db?

Member Avatar for rikiroxs
-1
87
Member Avatar for jlivvers

You mean actaully printing with priner on the paper? If so, best way would be to use reports (Crystal reports for example, which VS 2008 has). On the report you create your own parameters and pass values to these parameters.

Member Avatar for Mitja Bonca
0
155
Member Avatar for JOSheaIV

Why you use index of the row of array (and the same index is then in the dgv)? Why you simple dont use where clause to the ID? For example: your dgv`s row consists of: ID, name, ext (adivce: put id into 1st column) So when you sort the columns …

Member Avatar for JOSheaIV
0
154
Member Avatar for c#dummie

Ok, you are a bit unclear here with the issue you are facing. Would you like to populate listBox with already sorted items, or would you like to sort items, which are already in the listBox?

Member Avatar for jugosoft
0
700
Member Avatar for vedro-compota

YOu names the class as "MAP" and the same name is the method in it. The constructor can be the only method which can have the same name as the class. Example: [CODE]class ExampleClass { public ExampleClass() { //constructor of class ExampleClass! } private void Method1() { //method in ExampleClass …

Member Avatar for vedro-compota
0
182
Member Avatar for TheDocterd

As said.... one more thing, the parameter you want to pass to the sql query its not good to use in the query it self. Its better to "attach" it to the sqlCommand,m like this: [CODE] try { //Opening the sql connection and using custom sql statements SqlConnection conn = …

Member Avatar for TheDocterd
0
180
Member Avatar for Drakarus
Member Avatar for Drakarus

This should do it: But I am not sure what do you want exactly. Or do you want to put every single number from the file into its own row in the List (like: 1,3,7,9 add evey number to the list seperately), or you want to "join" number from one …

Member Avatar for iconoclazt
0
148
Member Avatar for vedro-compota

[CODE]string startupPath1 = System.IO.Directory.GetCurrentDirectory(); //or: string startupPath2 = Application.StartupPath;[/CODE] This will return the path of the debug diredctory in the current project.

Member Avatar for iconoclazt
0
104
Member Avatar for vedro-compota

If you want to check if something has happened with the code correctly or not, you better use boolean values. This is a simpe example: [CODE] private void GoingIntoMAP() { string path = @"C:\1\myFile.txt"; bool bSuccess = MAP(path); if (bSuccess) MessageBox.Show("An error has occured while reading file: " + path); …

Member Avatar for iconoclazt
0
119
Member Avatar for prayag.419

I agree with Hyperion. This is us getting no where. I assume everyone of us is so inteligent these days, that can use "The google wonder" to find the code, which would make his life easier. We are here to help ppl with their own specific issues, and I am …

Member Avatar for prayag.419
0
170
Member Avatar for IDC_Sharp

Here you go. I did an example code for you. I save all listView items into a List<T>. Each row of List is consisted of a string array. This is how you save the data from listView: [CODE] List<string[]> list; private void PopulatingListView() { ListViewItem item1 = new ListViewItem("item1", 0); …

Member Avatar for Diamonddrake
0
1K
Member Avatar for ibdatx

This is how you get selected item from a listBox: [CODE] private void PopulatingListBox() { string[] ar = new string[] { "Coffee", "Cream" }; listBox1.Items.AddRange(ar); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { string item = this.listBox1.SelectedItem.ToString(); MessageBox.Show("Selected item is : " + item); } [/CODE] Hope it helps, Mitja

Member Avatar for ibdatx
0
283
Member Avatar for moone009

You can create a new connection from Server Explorer and copy connection strings from properties in your project. Following link contains steps to create connection from Server Explorer [url]http://msdn.microsoft.com/en-us/library/s4yys16a(v=VS.90).aspx[/url] You can try following Connectionstring Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; You can also get list of connection string from [url]http://connectionstrings.com/sql-server-2008[/url] Hope it …

Member Avatar for Mitja Bonca
0
111
Member Avatar for GoogleEyedBass

If you only want array of integers to sort, you can do: [CODE] public static void bubbleSort(ref int[] a) { Array.Sort(a); } [/CODE]

Member Avatar for ddanbe
0
123
Member Avatar for moose333

try this: [CODE] private void ResizeImage() { //get the height and width of the image int width = this.Width; int height = this.Height; //create a new Bitmap the size of the new image Image img = Image.FromFile(@"F:/Year3/Software Development/Assignment2/gameoflife/gameoflife/Bitmap1new.bmp"); Bitmap bmp = new Bitmap(width, height); //create a new graphic from the …

Member Avatar for Mitja Bonca
0
159
Member Avatar for mahdi68

You can use Enumerable.SequenceEqual method: [CODE] static void Main(string[] args) { var a1 = new int[] { 1, 2, 3 }; var a2 = new int[] { 1, 2, 3 }; var a3 = new int[] { 1, 2, 4 }; var x = a1.SequenceEqual(a2); // true var y = …

Member Avatar for Mitja Bonca
1
3K
Member Avatar for michaelsd

Check it here for the answer: [url]http://stackoverflow.com/questions/81150/best-way-to-tackle-global-hotkey-processing-in-c[/url] [url]http://www.neowin.net/forum/topic/571215-c%23-how-do-i-create-some-hotkeys-inside-my-app/[/url] [url]http://www.daniweb.com/forums/thread215125.html[/url]

Member Avatar for Diamonddrake
0
892
Member Avatar for NewOrder

Array covariance specifically does not extend to arrays of value-types. For example, no conversion exists that permits an int[] to be treated as an object[]." When you pass an int[], it gets loaded into an object[] of length 1 and passed to your method.

Member Avatar for NewOrder
0
72
Member Avatar for hughser

Can you please post your code in here? Will be easier and much faster to help you out. Otherwise we can only guess what do you want. Regards, Mitja

Member Avatar for Mitja Bonca
0
199
Member Avatar for mcmc1212

What means columnar format? You mean one value under another? PS: would you like to have an array of items?

Member Avatar for Mitja Bonca
0
169
Member Avatar for udigold1

I dont understand. Can you do some pictures, that I can see what do you menan?

Member Avatar for Mitja Bonca
0
1K
Member Avatar for judithSampathwa

or on the end of some code do: [CODE]this.btnLogin.Focus();[/CODE] this should put the focus on login button. So after checking the user`s name and password, user can press the button with pressing Enter key. Hope it helps, Mitja

Member Avatar for judithSampathwa
0
121
Member Avatar for moose333

Try something like this: [CODE] public partial class Form1 : Form { private Graphics g1; public Form1() { InitializeComponent(); pictureBox1.Image = new Bitmap(500, 500); g1 = Graphics.FromImage(this.pictureBox1.Image); Pen gridPen = new Pen(Color.Black, 2); g1.DrawLine(gridPen, 0, 0, 100, 100); } } [/CODE] ... and read it here for some more info: …

Member Avatar for Mitja Bonca
0
2K
Member Avatar for Deven Mehta

What you did here in this code: [CODE] int a = int.Parse(textBox3.Text); int b = int.Parse(textBox3.Text); int c = a + b; textBox3.Text = c.ToString(); [/CODE] into textBox3 comes ONE value (lets say 3), when you create two local variables (a and b) and then you sum them together and …

Member Avatar for CrappyCoder
0
136
Member Avatar for jlivvers

If I understand you correctly, you would like to insert new row into some table in dataBase. And you want the new id od this row, correct? I hope you have numbers for id, then you can do a select query to get the latest id and increase it by …

Member Avatar for kvprajapati
0
1K
Member Avatar for nvidia123

[CODE] private void button2_Click(object sender, EventArgs e) { DateTime date = monthCalendar1.SelectionStart; MessageBox.Show("Selected date was: " + date.ToShortDateString()); } [/CODE]

Member Avatar for nvidia123
0
126
Member Avatar for GroundedWatts
Member Avatar for Mitja Bonca
0
104
Member Avatar for cthoes

[URL="http://stackoverflow.com/questions/146576/why-is-the-java-main-method-static"]Here[/URL] you can find some interesting answers on your question: and [URL="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/e202fabe-dc35-4317-a596-d61ba3746651"]here[/URL]. Have a good reading, and take is slow... you have to understand what these keyWords mean. Its something basic for the start. Mitja

Member Avatar for Mitja Bonca
0
152
Member Avatar for JDenham377

This should do the trick: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { DisablingButton(); } private void numericUpDown2_ValueChanged(object sender, EventArgs e) { DisablingButton(); } private void DisablingButton() { decimal value1 = numericUpDown1.Value; decimal value2 = numericUpDown2.Value; if (value1 …

Member Avatar for Mitja Bonca
0
945
Member Avatar for jpaterson2525

1st of all, you have to add a new namespace (using System.Net;) Now I will show you a simple example of how to get the website`s text: [CODE] List<string> list = new List<string>(); private void GetAllText() { WebRequest request = WebRequest.Create("http://www.daniweb.com"); WebResponse response = request.GetResponse(); using (StreamReader sr = new …

Member Avatar for jpaterson2525
0
87
Member Avatar for AMetnik
Member Avatar for raubercata

I did an example code for you. I hope it helps: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); string[] array = new string[] { "one", "two", "three", "four", "five", "six" }; checkedListBox1.Items.AddRange(array); label1.Text = "No checkBoxes checked..."; } private void ShowResults(int[] array) { label1.Text = …

Member Avatar for Mitja Bonca
0
119
Member Avatar for TheDocterd

You better try something different - more appropriate to use checked, or unchecked. This is to use true, false (its the same think, even better). In your database, set the column`s data type to bit. Bit can have only 2 values, this are true, or false. Then, how to get …

Member Avatar for TheDocterd
0
2K
Member Avatar for destruct0

Check it out here: [url]http://stackoverflow.com/questions/1596530/multi-dimensional-arraylist-or-list-in-c[/url] With arrayList: [CODE] ArrayList MainArray = new ArrayList(); MainArray.Add(new ArrayList()); MainArray.Add(new ArrayList()); MainArray.Add(new ArrayList()); (MainArray[1] as ArrayList).Add("Hello"); Response.Write((MainArray[1] as ArrayList)[0].ToString()); [/CODE]

Member Avatar for croker10
0
96
Member Avatar for Garrie

I hope this will do it: [CODE] private void CountGrades(/*parameter is here*/) { //put your ownn list of grades //you can pass them in the parameter from somewhere else! int[] array = new int[] { 3, 4, 5, 2, 2, 5, 4, 1, 2 }; string strGrades = null; int …

Member Avatar for Mitja Bonca
0
79
Member Avatar for el_jk

try to change Return with Enter [CODE] if (e.KeyChar == (char)Keys.Enter) this.Close(); [/CODE]

Member Avatar for Mitja Bonca
0
95
Member Avatar for james6754

Do you have this namespace in the References (Solution explorer tab)? Otherwise you can try with writing the full path: [CODE] System.Windows.Forms.MessageBox.Show("buuu"); [/CODE]

Member Avatar for Mitja Bonca
0
157
Member Avatar for yamini222

Check it here: [url]http://stackoverflow.com/questions/831727/c-decimal-parse-issue-with-commas[/url]

Member Avatar for ddanbe
0
125
Member Avatar for NewOrder

And you think you will do a monopoly (board) in the console? Wouldn`t be better to have the game in windows (windows application)? and btw, I have to clue what exactly are you trying to achine. please provide us more information. bye, Mitja

Member Avatar for NewOrder
0
159
Member Avatar for CharlieHolt

The connection string you are using is not correct. Take a look at here for your type of connection, but it should look something like that: [CODE] connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SampleFolder\MyProject\MyDataBase2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" [/CODE]

Member Avatar for Mitja Bonca
0
154
Member Avatar for arcticM

Try to figure out this code bellow, I dont know exactly what is the game about, so I midified it a bit, only to see how to use a string array in the code: I didnt use the timer, but I pick up the letters on a button click event. …

Member Avatar for arcticM
0
166

The End.