1,469 Posted Topics
Re: dgView.Rows.Add(); //what else? | |
Re: How do you populate the users list on main form? Is it from a DataTable (or dataSet) or some array list? You can use a delegate to pass the data from one form to another, and refreshing the gdv control with calling the method to populate it. YOu can take … | |
Re: This is how you can convert into both cases: [CODE] string ss2 = DateTime.Now.ToString("dd/MM/yyyy hh:mm.ss tt", System.Globalization.CultureInfo.InvariantCulture); string ss3 = DateTime.Now.ToString("MM/dd/yyyy hh:mm.ss tt", System.Globalization.CultureInfo.InvariantCulture); [/CODE] | |
Re: Try using Server - Client appication with tcpListener and tcpClient. This is an example code: [URL="http://www.developerfusion.com/code/3574/a-chat-clientserver-program-for-c/"]Source[/URL] [CODE] //The client: using System.IO; using System.Net; using System; using System.Threading; using N = System.Net; using System.Collections; using System.Windows.Forms; using System.ComponentModel; using System.Runtime.InteropServices; class TalkUser { static Form talk; static N.Sockets.TcpClient TC; [DllImport("kernel32.dll")] private … | |
Re: Take a look into the code I did only for you. Its a code, which allows the user to insert as many numbers and operands as he wants to create a formula. On the end, when he wants to create an out put, he only inserts the enter after number: … | |
Re: Try this: DELETE FROM allBooks WHERE ([Book Name] = 'book_NameListBox.SelectedItems[0].ToString()') | |
Re: Look at this example: [CODE] private void GettingFileContent() { string path = @"C:\1\test3.txt"; //example of two different arrays: //for string array (string[]) you need to define the lenght of it //for the generic list you dont need to //1. int rows = File.ReadAllLines(path).Length; string[] strArray = new string[rows]; //2. List<string> … | |
Re: Here is an example of how to use a timer. Important to know: Timer tick is the method which is called when the timer come to zero: [CODE] public partial class Form1 : Form { Timer timer1; int counter; public Form1() { InitializeComponent(); label1.Text = "countier: 0"; CreatingTimer(); } private … | |
Re: Update what? You mean dgv? 1st of all, you have to put the gdv creation into a seperate method, which has to be called only ones. Another method will populate the dgv - this method can be called numerous times. And you can use DataSource to populate dgv, no need … | |
Re: Adapost gave you a great starting point, you only have to build it up a bit: [CODE] private void Method() { string flag = "000-00-0000"; string[] lines = System.IO.File.ReadAllLines(@"C:\1\test6.txt"); foreach (string line in lines) { if (line.Contains(flag)) { MessageBox.Show("The number was found."); break; } } } [/CODE] | |
Re: No this is creating of a new instance of a TextReader object. Check [URL="http://support.microsoft.com/kb/307205"]HERE[/URL] what inheritance is. | |
Re: You need to create an event on the form for press down. Look at this code: [CODE] public partial class Form1 : Form { public Form1() { InitializeComponent(); this.KeyDown += new KeyEventHandler(Form1_KeyDown); } private void buttonBegin_Click(object sender, EventArgs e) { MessageBox.Show("Button \"Begin\" has been just pressed"); } private void Form1_KeyDown(object … | |
Re: Check it out here: [url]http://msdn.microsoft.com/en-us/library/bb311038.aspx[/url] | |
Re: tblAllEntries.Rows[0].Cells[3].Value = someThing.ToString(); //if the type of the column is not defined - by default is a type of string. | |
Re: You need to use delegate, which would check if the label needs invoke. | |
Re: You need to open streamReade before readint the stream. But instead of opening, you can use the keyword "using", which will do all the needed code instead of you (open, close). Put the StreamReader inthe the brackers of using, like this: [CODE] using(StreamReader sr = new StreamReader("filePath")) { //you code … | |
Re: If I understand it is like this: - you open form1 - then you would like to close form1, and open form2? or: - open form1 - open form2 - then close form2, and open form3 This is a bit difference, becuase you have started app. with form1 ( Application.Run(new … | |
Re: This is the best possible solution I will give you now that I know. YOu cannot read only one line from a text file, like read at index. No, you can read some random line, but until that line, the code will read all the lines from 1st to that … | |
Re: Hi, 1. to make the cell editable - when you are creating dgv, do: [CODE] dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgv.MultiSelect = false;[/CODE] 2. read the value from the dgv`s cell in a none dgv`s even or method (some button click for example), but remember, cell has to be selected: [CODE] int … | |
Re: Hi mate. You can use a timer. And set it to change the int value on every 5 minutes. If now is 1 set it to 0 and vice versa. You need some help? | |
Re: or... when you are showing form2, hide form1. And when you want to go back to form1 from form2, close (or hide form2) and show form1. As simple as that. | |
Re: Which array exactly? Or string[], ArrayList, generic List ? And how many columns has your dgv? Just for your info, for populating dgv, its best practice to use DataSet (or DataTable). Its specially designed for that, becuase you can create columns and rows, its actually a copy of dgv. In … | |
Re: Hi there vedro-compota, Variables exist within the scope of their creation. Make a variable within a class, and that's its scope. Make a variable within a method, and that's its scope. So make it within the program, but outside of any one class. If you make it in the program.cs … | |
Re: Singlem has given you the code you want. His code starts the timer in the constructor and after 10 seconds the timer Tick event rises and opens form2 - exactly as you wanted. Correct? Or do you want to start the timer? If so put the code of the timer … | |
Re: How will you choose 3,5 or 7 option? You have to do an option to let the user chooses it, and then its simple - get the number user has choosen, and pass it to the method which will create the field of buttons to play: [CODE] using System; using … | |
Re: I did it like: [CODE] public Form1() //constructor { InitializeComponent(); maskedTextBox1.Mask = "aa aa aa aa"; } [/CODE] and it works fine. | |
Re: A class is a reference type. When an object of the class is created, the variable to which the object is assigned holds only a reference to that memory. When the object reference is assigned to a new variable, the new variable refers to the original object. Changes made through … | |
Re: When ever you are not sure how long is gonna be the array, you never use a "basic" arrays like: string[], int[], bool[], or what ever of these kind. ddanbe has perfectly right, use a generic list, which is in my opinion my far the best type of array. If … | |
Re: You can use an even FormClosing. Create this event on form creation, and when you will try to exit form, the event formClosing will be rised: [CODE] public Form1() { InitializeComponent(); this.FormClosing+=new FormClosingEventHandler(Form1_FormClosing); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //here you do the code! } [/CODE] btw, for … | |
Re: you 1st go to the html code of that form and then see carefully that there should be one and only one from tag after body tag. and it should be closed before that body tag like this <body> <form ......> </form> </body> | |
Re: How you are going to open these 3 forms? Will you open 1 and then by clicking something on form1, this has to close and open form2, and so on? 1. You can simply use hide() method for the form you want NOT to show anymore (ps: but it has … | |
Re: 'select count(login) from mytable' | |
Re: Momerath is right. your "myobject" is only a reference to in instance of a class "Class1" some info [URL="http://msdn.microsoft.com/en-us/library/0b0thckt.aspx"]here[/URL]. Your 2nd example is called inheritance and polymosfism. You create one base class, and derived class(es) from it. Take a look at [URL="http://msdn.microsoft.com/en-us/library/ms173152.aspx"]here[/URL]. | |
Re: This can help you out: 1. the currency depending on the culture, 2. the currency in your wanted format without any cash mark [CODE] int iValue = 2879068; string sValue1 = String.Format("{0:C}", iValue); string sValue2 = String.Format("{0:#,#.}", iValue); [/CODE] but in case if you want to have some cash mark, … | |
Re: The code above will never work, for many reasons: 1. as ddanbe said, C# needs Main() method to get started (so no Go() method - change the name to Main) 2. About _gameDirectory = FindGameDirectory() ? Where did you innisiate it? Its from no where now. You cannot call in … | |
Re: Becuase you are using static methods, you can only use the objects inisde of them, and whats is passed from one to another. This is what you can do: [CODE] class MyClass { public static void Main(string[] args) { Pieces[,] = ChessBoard(); } public static Pieces[,] ChessBoard( ) { Pieces … | |
Re: Is the string seperated by something? By whitespaces maybe? | |
Re: [CODE]//get the selected item: string value = listBox1.SelectedItem.ToString(); //delete it: listBox1.Items.Remove(value); [/CODE] there is another way to get the selecte index (thats an integer) and then remove with using method "RemoveAt", like: [CODE]int index = listBox1.SelectedIndex; listBox1.Items.RemoveAt(index);[/CODE] | |
Re: I dont find anything that can be connected with if,else loops in your code, ok it could be, but it would be too complicated. In my opinion fawi`s approach is the right one, I will only modify it a bit, to suit your needs: [CODE] bool flag = false; for … | |
Re: This can be some kind of a leading way for you. There is plenty of way how to implement your issue, but one of my best and very efficient is to use while loop. While some value (usually is a boolean) is not the contrary of the pre-set one, the … | |
Re: This is some other solution: [CODE] void ReversingMethod() { string str = "This is a string that needs to be reversed"; Array array = str.Split(' '); Array.Reverse(array); str = null; for (int i = 0; i < array.Length; i++) { str += array.GetValue(i) + " "; } MessageBox.Show("This is a … | |
Re: Maybe this might help you out: [CODE] private void Form1_Load(object sender, EventArgs e) { this.Icon = Properties.Resources.MyPic.ico; //MyPic is the icon in your resources! } [/CODE] | |
Re: Why dont you put a StreamReader object out of any loops, so it can be accessible to any other sub brackets, loop, etc, like: [CODE] StreamReader myReder; DataTable myTable = new DataTable("MyTable"); DataRow myRow; try { myReader = new StreamReader(fileFullPath); } //code continues.. [/CODE] | |
Re: Why do you want to encode a text? A text its alredy encoded, dont you think. You only need to get it from the file into a label. | |
Re: btw, why do you use a BinaryRader class, becuase you only read from a text file? Why you dont use StreamReader instead, and you wont even need to convert byte into string, something? An idea. Mitja | |
Re: Becuase the private field (price) is created inside a Program class. Even you have called it from a static method, which only can access to the parameters inside of it, you created a new instance of a Program class, and used this instance to connect to the private field. Pritave … | |
Re: Can you some me the code with which you create a dgv and its columns? | |
Re: What do you want to validate? Stirng, int, double, bool? | |
Re: On form load call this method: [CODE] private void ResizingForm() { this.Width = 1024; this.Height = 768; } [/CODE] | |
Re: Does your table get filled up? If not, please try to change your query select string with this one: [CODE]string query = "SELECT Extrausage FROM perclientreport WHERE Bill > '" + 0 + "'";[/CODE] and about updating: [CODE] double ext = Convert.ToDouble(dt.Rows[i]); ext = (ext * 1024) / 100; string … |
The End.