536 Posted Topics
Re: You are canceling the row validation for all rows, including valid ones. [CODE]private void grdvEnergy_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { e.Cancel = true; //<-- this should only be done if an error exists. datagridview1.Rows[e.RowIndex].ErrorText = "Error message"; }[/CODE] You need to add a conditional statement to allow valid rows to commit. … | |
Re: An XML file can be created and edited using an [I]XmlDocument[/I] object and other classes from the [I]System.Xml[/I] namespace. However, there are other ways to create XML documents (e.g. from a DataTable or DataSet). It depends very much on what you mean by "plain text". As spdesings pointed out you … | |
Re: You are only storing a pointer (IntPtr) to the bitmap. Are you sure that the bitmap still exists and is where it was when it was enqueued? I.e. Is the pointer still valid? | |
Re: There is no defined structure for a .dat file. It is often used by application to indicate data of some kind. If you know the application that created the files then maybe you can find out the structure of the .dat file. Otherwise you are stuck with having to inspect … | |
Re: If by [I]selected[/I] you mean [I]Checked[/I] then just set them all unchecked (i.e. [iCODE]rb.Checked = false;[/iCODE]). [Edit] Also, make sure the they are not set by the form designer. Set them all false there too. | |
Re: Did you really need to post all those [iCODE]Control.Font Font = new Font(ff, 9, fontStyle);[/iCODE] lines in your code sample? It made the post unnecessarily big.:@ Not sure if this will fix your problem because it still uses the [I]PrivateFontCollection[/I]. However, the only time I had to use a font … | |
Re: I ran in to the same problem some time ago. One easy way is to put the files in a folder off the root. (e.g. "C:\MyData"). The more elegant but much more difficult solution is to have a custom action in the installer to modify the security of the path. … | |
Re: The code you copied uses a set of global (local to form) variables to store the page infomation for the DGV. [CODE] private string NavClicked = ""; private string RecordID1 = ""; private string RecordID2 = ""; int CurrentPage = 1; [/CODE] I think that this might be the root … | |
Re: Do you have two tab controls or two tabs on a single tab control? Is there one or two forms? Not sure what you mean by [QUOTE]I have class already made for the first tab.[/QUOTE] Any code needed to manage the controls should be on the form. I will assume … | |
Re: You forgot to add the place holder for the value. [CODE]Console.WriteLine("first dimension length {0}", arr.Length);[/CODE] | |
Re: Without some code we can not know what is happening. What do you do when a value is selected? | |
Re: If the second form is open using ShowDialog (which it probably should) then you can add a property on the second form to hold the new listbox value. Then when the form is closed retrieve the value from the property and update the list box on the first form. Add … | |
Re: Your function is declared [I]static[/I]. Is [I]NulltoString [/I]also static? | |
Re: Slightly adapted version allows "nudging" of any control. [CODE] public void NudgeControl(Control ctrl) { // Store the original location of the form. int xCoord = ctrl.Left; int yCoord = ctrl.Top; // An integer for storing the random number each time int rnd = 0; // Instantiate the random generation mechanism … | |
Re: Firstly, please look at the properties that are available on the [I]OpenFileDialog[/I]. There are some there that will answer your first question. When the dialog closes with [I]DialogResult.OK[/I] then you get the selected file from the [I]FileName[/I] property. To run the associated program, just execute the file in a new … | |
Re: Do you mean label?:confused: To do this with a [I]TextBox[/I], in the [I]TextChanged [/I]event handler, parse the [I]Text [/I]property for the short-cuts you want to support and replace as necessary. | |
Re: I just tried to run the command in MS SQL Server Management Studio Express (2005). [I]create table tbl (orderdate date)[/I] It does not execute giving the Error: [COLOR="Red"]Msg 2715, Level 16, State 7, Line 1 Column, parameter, or variable #1: Cannot find data type date.[/COLOR] Also, when I use the … | |
Re: I found these two links to be most useful when learning about Regex. [URL="http://www.codeproject.com/KB/dotnet/regextutorial.aspx"]The 30 Minute Regex Tutorial[/URL] [URL="http://msdn.microsoft.com/en-us/library/az24scfc.aspx"]Regular Expression Language Elements[/URL] Also this one has some samples for various things. [URL="http://regexlib.com/Default.aspx"]Regexlib.com[/URL] | |
Re: I think you may want [iCODE]txtReminder.Select();[/iCODE] [Edit]@Ryshad: [QUOTE=MSDN Control.Focus]The Focus method returns true if the control successfully received input focus. The control can have the input focus while not displaying any visual cues of having the focus. This behavior is primarily observed by the nonselectable controls listed below, or any … | |
Re: You might want to consider using the application [I]Settings[/I]. (Properties Settings Tab) There are two types of settings, Application and User. User settings are specific to the current user and it is possible to read/write User settings. These are generally used to save user configurable options. Application settings are read … | |
![]() | Re: The default base is 10. Try this [CODE]myNewByte = System.Convert.ToByte(hexString, 16); [/CODE] ![]() |
Re: What do you mean by "view wireless networks"? | |
Re: [QUOTE]I need to learn visual studio, sql, asp.net, and building and maintaining databases, how can i best do this?[/QUOTE] If that is what you want to do then why not set your self a problem? Create a DB to store some information of interest to you. (E.g. Document your collection … | |
Re: Try using += operator. [CODE]tpricehw+=MB+Monitor+Proc+CC+KB+M+VC+ODD+totalpram+totalphdd;[/CODE] BTW. This is the C# forum. | |
Re: I have tried doing similar things with the [I]CheckedListBox [/I]before. The information on the checked items is not yet updated when the [I]ItemCheck[/I] event fires. This just makes all the logic very difficult. I gave up trying doing my logic in the [I]ItemCheck[/I] event. The solution I came up with … | |
Re: One way to handle this is to read all the received data in to a byte array. Then parse the byte array to exctract what you need. Another is to parse the stream as you read it byte by byte (or block by block). However, this can lead to the … | |
Re: Try "[B]bit[/B]" that's what it is for SQL. | |
Re: If you want to draw an image cliped to a triangle then you need to use a [I]GraphicsPath [/I]to set a clip [I]Region[/I]. The following code clips the [I]Bitmap1.bmp[/I] image when drawn at the top left of the form. [CODE] private void Form1_Paint(object sender, PaintEventArgs e) { // create a … | |
Re: You will need to read the file in to a byte array; try using [iCODE]System.IO.File.ReadAllBytes(filename);[/iCODE] Then pass this as a parameter to a varbinary(MAX) column in you DB. Don't forget to store the filename and extension; if you store them seperately you will later be able to sort/filter on file … | |
Re: That's a lot of code! Where does the error occur? | |
Re: I just set up an unbound DataGridVeiw with three columns as you describe. The CheckBoxes are checked/unchecked by the user with out any problem. Are you sure you have allowed user edits. Check the ReadOnly status of the columns.:?: Note: When you uncheck the "Enable Editing" on the DataGridView Task … | |
![]() | Re: You've missed out [I]InitializeComponent[/I] from the form constructor. ![]() |
Re: Does [I]BitBlt[/I] return 0? Can you not use [iCODE]gdest.CopyFromScreen(location, new Point(), new Size(1, 1));[/iCODE] to get the screen color? How much of a difference is the color returned by [I]GetColorAt[/I] and the test color. Maybe you would be better off passing in the color and using [I]gsrc.GetNearestColor(color)[/I] to ensure your … | |
Re: I found [URL="http://www.codekeep.net/snippets/34d04a2b-7876-441a-b0ea-c5960dde2b7d.aspx"]this link[/URL] that shows one way to do it. I adapted it slightly to make it a bit clearer. [CODE] private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { // get style to use for row header cells DataGridViewCellStyle style = dataGridView1.RowHeadersDefaultCellStyle; // get pen (needed to get text brush) … | |
Re: What a very clumsy way to do padding. There are methods to add padding to a string. Take a look at this. [CODE] string amt = " 123.56 "; string value = string.Empty; decimal dec; if (decimal.TryParse(amt.Trim(), out dec)) { value = (dec * 100).ToString("F0"); value = value.PadLeft(16); //<-- not … | |
Re: Take a look at the "Similar Threads" to the right of your post. This should get you started. | |
Re: I'd let the compiler manage the indexing for you by declaring the array as 2D. [CODE]string[,] array = new string[,] { { "0", "1" }, { "2", "3" }, { "4", "5" } };[/CODE]Then your code will be very similar to the 1D version, just add the extra index for … | |
Re: On deserialize (assuming no errors occur) each record must be read in turn. The stream pointer should be pointing to the start of the next record after reading the first. Just add each record to your list in turn and read the next. I would recommend that you first serialize … | |
Re: You are changing the list as you iterate through it. This always causes problems. Try reversing the search order. [CODE]for (int i = tree.Items.Count - 1; i > 0; i--) { if (tree.Items[i].ToString().Contains(" ")) { tree.Items.RemoveAt(i); } } [/CODE] [B]Note[/B]: If the list is DataBound then you must modify the … | |
Re: You can not use relative paths in the WebBrowser. But you can find the path of the executable by using Application.ExecutablePath. [CODE]string folder = System.IO.Path.GetDirectoryName(Application.ExecutablePath); string url = System.IO.Path.Combine(folder, "xy.htm");[/CODE] | |
Re: [QUOTE]If all parameter passing is by value by default, why does the ProcessList() function not have a local copy of myList ? (does it?)[/QUOTE] Objects and other reference types (this includes lists) are passed by reference by default. Or rather, the object reference is passed by value (which is sort … | |
Re: I think the problem is that you are moving the child node. [CODE]public void DoTreeWork(RadTreeNode node) { RadTreeNode n = node; RadTreeNode temp = new RadTreeNode(node.Text); temp.Name = node.Name; foreach(RadTreeNode child in n.Nodes) ----------> The Exception is thrown. { temp.Nodes.Add(child); //<-- Moving child! Should do copy DoTreeWork(child); } tv2.Nodes.Add(temp); }[/CODE] | |
Re: The image of another ImageBox is not used when determining what to paint for transparent images. As Ryshad pointed out it is the background of the parent control that is used. Rather than put the background image in a picturebox, either [LIST] [*]Set the forms background to your background image. … | |
Re: A mechanical engineer, an electrical engineer and a software engineer are in a car when it malfunctions and they speed uncontrolably down a hill, finally coming to a stop on a grass verge. The mechanical engineer says "Lets check if the brakes are faulty". The electrical engneer says "Lets check … | |
Re: [COLOR="Red"]//I HAVE TO DO SMTH HERE (IN MY OPINION)[/COLOR] What about doing this: [CODE]Form form = obj as Form; if (form != null) { form.MdiParent = this; form.Show(); }[/CODE] | |
Re: I have never used this before but when I tried it the tooltip always showed up in the same place. This place is however determined by the current mouse position meaning that it could be anywhere. The help tooltip window is shown with its top centered where the mouse is … | |
Re: Look in the [I]System.IO[/I] namespace. Especially [I]System.IO.File[/I] and [I]System.IO.Directory[/I]. These are used to inspect the file system. | |
Re: Use the [I][B]CellBeginEdit [/B][/I]event. Not used it myself but it is a [B]cancel[/B]able event so I think setting [I]e.Cancel [/I]will block the edit from starting. As with other events for the DGV, test [I]e.ColumnIndex[/I] and [I]e.RowIndex[/I] to only allow editing of the cells you want. | |
Re: If the effect you want is to have all but one controls disabled while the second form is open then disable them just before you open the second form. One way is to disable all the controls using the [iCODE]foreach(Control c in oForm.Controls)[/iCODE] idea show by Teme64. Then enable the … | |
Re: Why not take a look at [URL="http://www.daniweb.com/forums/thread297772.html"]this thread[/URL].;) What have you tried already? |
The End.