536 Posted Topics
Re: I know that this is solved but another alternative is to create your own derived control and add any additional properties, methods or delegates you need. [CODE] public class MyDataClass { // define class here } public class MyRadioButton : RadioButton { public MyDataClass DataItem { get; set; } }[/CODE] … | |
Re: Of course the main form is created again. That is exactly what you are doing on line 2. You need to pass a reference to your main form to the search form. Try looking at [URL="http://www.daniweb.com/software-development/csharp/threads/268624/1165935#post1165935"]this post[/URL]. Which is also found in the [B]Similar Threads[/B] for this thread! | |
Re: You did not say whay the error is? What is the error message and on what line does it occur? | |
Re: You can get the same output using a bit-mask. [CODE]Console.WriteLine("Using bitmask"); for (int i = 0; i < read.Length; i++) { int bitMask = 0x8000; // start from left most bit Console.Write(string.Format("Register {0}: ", i)); for (int j = 0; j < 16; j++) { // test bit status and … | |
Re: Your code in line 3 only allows numbers. You need to change this to allow the '.' too. | |
Re: To control the way the items are displayed in a listbox you need to set [I]DrawMode[/I] to either [I]OwnerDrawFixed[/I] or [I]OwnerDrawVariable[/I]. [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.drawmode.aspx"]MSDN - Listbox.DrawMode[/URL] Not sure how/if this will work with a databound listbox (it should do). | |
Re: If the first form is an MDI master form (has [I]IsMDIContainer[/I] = true) and the second form is a child form (has [I]MdiParent[/I] = firstform) then the child form is held inside the borders of the main form. Setting the borders of the child form to be None ([I]FormBorderStyle = … | |
Re: Sounds like you might be doing the download in the UI thread. If this is the case then the whole UI is probably hung waiting for the download to finish. The easiest way to manage a big task in a windows forms app is to use a BackgroundWorker. The code … | |
Re: You can get a list of the [I]PictureBoxes [/I]in the [I]Controls [/I]collection using the linq extension method [B]OfType[/B]. Then sort the list to get them in name order. [CODE]var myPics = this.Controls.OfType<PictureBox>().ToList(); myPics.Sort((a, b) => { return a.Name.CompareTo(b.Name); }); [/CODE] You should only need to do this once, in the … | |
Re: It should be possible to just copy the whole of the solution folder via a memory stick. If you need to keep the size down then use [I]Build - Clean Solution[/I] to remove the built files first. | |
Re: [QUOTE=murali53;1627329]When i double click on saved file icon my application is opening in my file format with my UI design,but not he data in it.[/QUOTE] Does this mean clicking on the file in file explorere? If so, then you need to make your application main method handle incoming parameters. Something … | |
Re: Did you try setting the [I]Multiline [/I]property to false. | |
Re: I had to do something similar myself. I think that your table 2 idea is better. Better scalability, greater flexibility for searching. With the correct table indexing performance should not be an issue. For a whole lot of ideas on databases and SQL I generally go to [URL="http://www.sqlservercentral.com/"]http://www.sqlservercentral.com/[/URL] I find … | |
Re: The Add..Seat methods are adding seats to the main form. You need to add the seats to the appropriate panel! E.g. at line 86 use [iCODE]this.PlatinumPanel.Contols.Add(seat);[/iCODE] Additionally, each of the three Add...seats methods has a lot of common code. Find where they differ, then using parameters make a common method. … | |
Re: Test the Count Momerath mentions in the ItemCheck event. There you can block the check by setting the e.NewValue to Unchecked. | |
Re: Capture the DataGridView CellClick or CellDoubleClick events. In the event handler test the DataGridViewCellEventArgs RowIndex property. Using this fill the text boxes with the correct row data. | |
Re: Not quite sure what you mean by ".. already selected... cannot select that item again". Two ideas that might help you achieve what you want. 1. Remove the item once selected - (perhaps moving it to another listbox). 2. Set SelectionMode to MultiSimple - that way once it is selected … | |
Re: Your problem is in "SetOccupiedSeats". You are not changing any of the values in the seat list. Try this in place of your [iCODE]if (seatOccupied == 1) { ... }[/iCODE] code. [CODE]list.First(w => w.Number == seatNumbr).Occupied = seatOccupied == 1; [/CODE] | |
Re: [QUOTE=nmaillet;1625750]I know when building VC++ in Visual Studio, it gives you the option to run the previous successful build, if there are compile errors.[/QUOTE] Yes, this caused me much confusion when I started with VS until I turned it off. It is found in Tools - Options - Projects and … | |
Re: You just need to use the appropriate SQL command. I use something like this: Backup - "USE MASTER; BACKUP DATABASE [<DBName>] TO DISK = N'<FileName>' WITH FORMAT, INIT, NAME = N'<Backup Name>', SKIP" Restore - "USE MASTER; RESTORE DATABASE [<DBName>] FROM DISK = N'<FileName>' WITH FILE = 1, REPLACE" Execute … | |
Re: [QUOTE=mrjimoy_05;1625614]I am using Microsoft Visual Studio 2010 Express for Windows Phone and .Net 4.0 Framework.[/QUOTE] [B]Windows Phone[/B] version is closer to [B]Silverlight [/B]and does not have support for the static [I]File.Read..[/I] methods. [URL="http://msdn.microsoft.com/en-us/library/system.io.file(v=VS.95).aspx"]See here.[/URL] You will have to use a [I]TextReader[/I], [I]StreamReader [/I]or [I]FileStream [/I]to execute the reads long hand … | |
Re: Judith, you asked a similar question in [URL="http://www.daniweb.com/software-development/csharp/threads/375715"]this thread[/URL]. What effect are you trying to achieve? [Edit] What do you mean by "attach one user control to each menu strip"? | |
Re: I am guessing now.:confused: Is the problem that the month is always 1 for the source data "2 Yearly 25"?:idea: If this is the case then perhaps you should add a DueMonth field to the original data table or allow DuePattern to have two fields e.g. "25/3". Then use the … | |
Re: Have you looked at the Click-Once deployment. This does something like what you want in that it will look for the latest version before the program is executed and automatically download if it is newer. | |
Re: Your start button is correct. But each of the [I]stop [/I]buttons should only [I]stop [/I]one of the timers. You do not need to [I]start [/I]the timers in your [B]stop [/B]buttons! | |
Re: The ToolStripMenuItem class has a ShortcutKeys property. Just set this to what you need. | |
Re: Why do you need to convert [I]GlobalClass.globalweekdt[/I]? Have you checked what value the convertion returns. e.g. [iCODE]MessageBox.Show("globalweekdt = {0}",Convert.ToDateTim(GlobalClass.globalweekdt));[/iCODE] If[I] GlobalClass.globalweekdt[/I] is a string then it might be a localization issue due to different datetime formats. | |
Re: What ways have you already tried? Is it necessary that it is an ArrayList? | |
Re: The following quick example should help. [CODE]public Form1() { InitializeComponent(); // create embedded form var form = new Form(); form.SetBounds(100, 100, 200, 300); form.BackColor = Color.PaleTurquoise; // set to highlight this form position form.TopLevel = false; // important otherwise cannot add to Control collection form.Visible = true; // important otherwise … | |
Re: Have you looked at using Properties.Settings with a user scoped setting. | |
Re: A foreach loop is just an easier way to access each item in a list or array. [CODE]foreach (DataRow dr in dtPeople.Rows) { //do something with dr }[/CODE] is similar to [CODE]for (int i = 0; i < dtPeople.Rows.Count; i++) { DataRow dr = dtPeople.Rows[i]; //do something with dr }[/CODE] … | |
Re: You reached 186 points, so you achieved position 141438 of 570619 on the ranking list You type 259 characters per minute You have 44 correct words and you have 1 wrong words Not as fast as I thought.:-O But then I'm usually only typing code, which is not the same. | |
Re: It is generally not possible to host one application in another; which I think you are trying to do. If you are trying to write a MDI text editor then you will have to do some of the work. You can add a TextBox or RichTextBox control to a child … | |
Re: This function is provided by [I]string.Join[/I]. e.g. [ICODE]string.Join(", ", Values);[/ICODE] | |
Re: In the [I]AfterCheck [/I]event the [I]TreeViewEventArgs [/I]contains the node that was just (un)checked. Try this instead. [CODE]private void treeView1_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Node.Checked) { aResult.Add(e.Node); } else { if (aResult.Contains(e.Node)) { aResult.Remove(e.Node); } } } }[/CODE] BTW. To get your [I]CheckedNames[/I] to work you must use recursion to … | |
Re: I had a similar problems when using [I]Image.FromStream[/I] with a [I]MemoryStream [/I]object. The local [I]MemoryStream [/I]object goes out of scope when you exit the function. As the image does not have a strong reference to the stream it is subject to Garbage Collection. This means the [I]MemoryStream [/I]is closed and … | |
Re: In the line [iCODE]double regFee = Convert.ToDouble(cmbFeeSchedule_Registration.SelectedText);[/iCODE] in SaleTax it is possible that '[I]SelectedText[/I]' does not yet have a value. This is possible because your code is running in the [I]SelectedIndexChanged [/I]event. If you want to use the [I]SelectedText [/I]then consider using the [I]TextChanged [/I]event instead. Perhaps more suitable would … | |
Re: Surely all you need to do is [iCODE]newParentNode.Tag = <some value>;[/iCODE] maybe [iCODE]newParentNode.Tag = dta;[/iCODE] Ignore this. See next post. | |
Re: You should be able to use the FK constraint to retrieve the images for a specific message without needing to iterating through the whole image table. Use DataRow.GetChildRows to do this. Adding suitable indexes may also improve your performance. | |
Re: Use the SelectedIndex property of the tab control to identify the current tab. Or use the SelectedTab property to directly access the current TabPage. | |
Re: krishnisilva, The Validating event is fired when the user leaves a control. It is possible to prevent the user from leaving the control if the value is invalid by setting Cancel on the CancelEventArgs parameter to true. [CODE]private void dpStartD_Validating(object sender, CancelEventArgs e) { if (System.DateTime.Compare(dpStartD.Value, DateTime.Now) < 0) { … | |
Re: Drawing to a control's Graphics object like this is only temporary. When the control is next refreshed the image will disappear. You need to create an image object and draw to that then assign this to the picture box. Try modifying your code as below. You should them be able … | |
Re: The SaveFileDialog does not save anything. It is used to get the filename and path of where the user wants you to save the data. You must test the return value from the ShowDialog method. If it is DialogResult.OK you then save the data to a file using the FileName … | |
Re: One of the built in column classes available for the DGV is the [I]DataGridViewCheckBoxColumn[/I]. This has a [I]TrueValue [/I] property and a [I]FalseValue[/I] property that determine the value of the data in the underlying DataTable (and database) for the checked and unchecked state of the checkbox shown in the column. … | |
Re: This code snippet should help you do what you want. [CODE]int x = Console.CursorLeft; int y = Console.CursorTop; ConsoleColor initColour = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("This is white Text"); Console.ForegroundColor = initColour; Console.WriteLine("Press any key to continue..."); Console.ReadKey(); Console.SetCursorPosition(x,y); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("This is yellow Text"); Console.ForegroundColor = initColour; Console.WriteLine("Press … | |
Re: The result from the IComparer.Compare is the result of the comparison, not the difference between the values tested. [CODE=text]Less than zero (usually -1) means x is less than y. Zero means x equals y. Greater than zero (usually +1) means x is greater than y.[/CODE] See [URL="http://msdn.microsoft.com/en-us/library/system.collections.icomparer.compare.aspx"]IComparer.Compare Method[/URL] | |
Re: It might be better to pass the row to the display form instead of the data values. That way any changes on the child form can be written directly to the relevant row. In the main form write a method to add a new row and spawn a new form. … | |
Re: Sounds like the CanonCamera object (or at least the SDK object it wraps) wants its methods executed on the thread in which it was created. You might need to invoke a method in your timer(s) to run camera operations. [CODE]private void Timer_foto_Tick(object sender, EventArgs e) { this.Invoke(TakeFoto); // forces execution … | |
Re: [I]MdiChildActivate[/I] is an event called by the parent MDI when a child form is activated. The event handler should be on the main form not the child form. Try this. [CODE]private void MDIParent1_MdiChildActivate(object sender, EventArgs e) { string childName = "No Child Open"; if (this.ActiveMdiChild != null) { childName = … | |
Re: A very good question. I tried the code (in VS2005) and get the same results. It is because the compiler is using an Int32 for the result of the calculation. Constants are Int32 by default and the result is therefore being promoted to Int32. Try this instead. It gives the … |
The End.