1,469 Posted Topics
Re: Whats this method: c.CheckingValue() ? | |
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: Try this: [CODE] decimal moneyvalue = 1234567890.09m; string html = String.Format("{0:C}", moneyvalue); [/CODE] | |
Re: 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 | |
Re: 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 | |
Re: 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? | |
Re: 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. | |
Re: 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 … | |
Re: 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? | |
Re: 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 … | |
Re: 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 = … | |
Re: 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 … | |
Re: [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. | |
Re: 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); … | |
Re: 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 … | |
Re: 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); … | |
Re: 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 | |
Re: 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 … | |
Re: If you only want array of integers to sort, you can do: [CODE] public static void bubbleSort(ref int[] a) { Array.Sort(a); } [/CODE] | |
Re: 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 … | |
Re: 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 = … | |
Re: 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] | |
Re: 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. | |
Re: 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 | |
Re: What means columnar format? You mean one value under another? PS: would you like to have an array of items? | |
Re: I dont understand. Can you do some pictures, that I can see what do you menan? | |
Re: 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 | |
Re: 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: … | |
Re: 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 … | |
Re: 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 … | |
Re: [CODE] private void button2_Click(object sender, EventArgs e) { DateTime date = monthCalendar1.SelectionStart; MessageBox.Show("Selected date was: " + date.ToShortDateString()); } [/CODE] | |
Re: How you want to have numbers listed? Horizontal ot vertical? | |
Re: [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 | |
Re: 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 … | |
Re: 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 … | |
Re: What is the problem? Do you get any error message? | |
Re: 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 = … | |
Re: 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 … | |
Re: 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] | |
Re: 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 … | |
Re: try to change Return with Enter [CODE] if (e.KeyChar == (char)Keys.Enter) this.Close(); [/CODE] | |
Re: 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] | |
Re: Check it here: [url]http://stackoverflow.com/questions/831727/c-decimal-parse-issue-with-commas[/url] | |
Re: 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 | |
Re: 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] | |
![]() | Re: 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. … ![]() |
The End.