698 Posted Topics
Re: Is it not bad OO design to directly access the parent controls from the child? Wouldnt using a property be a more appropriate method? It maintains encapsulation and allows you to validate the value passed from the child: [CODE] public partial class Parent : Form { //write-only property //could add … | |
Re: Or similarly [icode]string path = System.Reflection.Assembly.GetExecutingAssembly().Location [/icode] returns the path of the file containing the exectable :) | |
![]() | Re: Just as an aside...if you have created and shown the second form within the first, you can add an event handler within the first form to catch the closing of the second form. (is that as confusing as it seems to me? lol) Like this: [CODE] public partial class frmLogin … |
Re: As stated, your question is a little vague. Do you need the user to be logged in before they can close frmMainMeny, or does the user log in before they can view frmMainMenu and when the form is closed you want to return to the login screen? If its the … | |
Re: Hi, To the best of my knowledge the datagridview doesnt support a cursor property. You could acheive it manually by hooking up a CellMouseMove event handler, checking the current Column index and setting the cursor as applicable: [CODE] private void dataGridView1_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex >= 0 && … | |
Re: Wow, run before you can walk? When you say you are new to C#, are you moving over from another language? If you arent familiar with all the structures and concepts involved with a coding language then you'd be best to start with something simpler and work your way up. | |
Hi Guys, I am having a hellish time getting this to work...i'm fairly new to asp.net so i may be making some glaringly obvious mistake :/ In the page init i read products from my database and populate the page with images/links/buttons/etc. The problem i have is twofold: If i … | |
Re: You can read the file contents in line by line then use string.Split() to convert each row into a string array. The following works provided that the array definitely has the same number of rows as columns: [CODE] string filePath = @"C:\Users\Dan\Documents\test.txt"; StreamReader sr = new StreamReader(filePath); string[,] strArray = … | |
Re: Did i miss something? I tried copying the code to test your control but when i try to compile it says that 'TranslateCenterImageMousePosition' and 'translatezoomrectangle' canot be found : / | |
Re: Heres an example of nested loops that acheives what you are trying to do: [CODE] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim TotalFilledRooms As Integer = 0 Dim perc As Double For i As Integer = 1 To 8 Dim response As Boolean = … | |
Re: Your problem is at line 811 [iCODE]currentGrid[cell] = whosGo;[/iCODE] Arrays are a reference type, so when you change currentGrid[cell] you are actually changing OX[cell] so the method cycles through filling each array entry. Try using array.Clone() to pass the OX array in, or create a temporary array in the method … | |
Re: Firstly, what are you trying to achieve? If you are adding the items to the first Listbox at design time, why dont you just paste them into the second listbox as well? If you really want to do it in code you can do the following. But please note this … | |
Re: In your code, "static void which..." says that you are creating a static method with no return type. You are then using "return". If your method is going to return a value you need to set its return type: "static int which" will return an integer. Also, in your code, … | |
Re: Check out ther [URL="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx"]backgroundworker [/URL]object. It allows you to report progress back to the main form to update your progress bar and reports its completion. Alternatively, if you use a regular thread you will need to use [URL="http://blogs.msdn.com/csharpfaq/archive/2004/03/17/91685.aspx"]invoke [/URL]to access members of the UI thread. | |
Re: Try something like this: [CODE] private void Form1_Load(object sender, EventArgs e) { PictureBox pb = new PictureBox(); pb.Click += new EventHandler(ClickEvent); pb.BorderStyle = BorderStyle.Fixed3D; panel1.Controls.Add(pb); } private void ClickEvent(object sender, EventArgs e) { MessageBox.Show("Clicked"); } [/CODE] | |
Re: Have you tried diffResult.TotalDays? .Days only returns the day portion of the timespan, so if the difference between the dates was 1 month, 1 week and 1 day then .Days would return 1 whereas TotalDays would return 39 or something close to it depending on the dates you were comparing. | |
Re: If you don't need the ID to be visible you could look into the DisplayMember and ValueMembers when databinding to allow you to show the Code and have the ID as the value member. Alternatively, you could consider using a datagridview, you can have as many columns as you like … | |
Re: You can look into [URL="http://msdn.microsoft.com/en-us/library/ms191250.aspx"]computed columns[/URL] | |
Re: Have you created a variable called currenttime? IF so, have you instantiated and assigned a value to it. If you were trying to add the current time without using a variable you need to check out DateTime.Now and its various members. | |
Re: Firstly, i would suggest you look at the TotalMillisecond property rather than the Millisecond which only stores the millisecond [B]portion[/B] of the total. eg, if someone took 30.22 seconds then the Milliseconds would return 220 whilst the TotalMilliseconds would return 30220. Secondly, what is your intent when you say you … | |
Re: If the MSDN didnt help, try [URL="http://www.daniweb.com/code/snippet241539.html"]my tutorial[/URL]. Its a simple intro to event handlers | |
Re: Im not entirely sure you have retrieved it correctly, or if you have the encoding is odd. I played around with several different conversions and got nothing but gibberish from the string you gave above. | |
Re: it depends how you want to go about it; as you said, its unlikely that one robot will win hands down (best in all three fields). One approach could be to order the three elements in order of importance and rank in that order. eg: Element Ranks: 1st Goals Scored … | |
Re: Please use descriptive thread titles...'C#' does not describe the problem you are having. Also, the policy here at Daniweb is to help those who show effort. Have a go for yourself then post if you have specific problems. As a hint, the datagridview has a property called SelectedRows which returns … | |
Re: Why can you not add the code? Can you be more specific? Have you used a toolStripDropDown item or is it a different control? | |
Re: Can you clarify what part you need helpo with: retrieving the text from the second form or writing the text to the image? | |
Re: What part of your code do you need help with? You have methods to upload, read and extract sheet names, but you arent calling any of them. If you want to output the sheet names to a textbox you need to input a filename somehow (either type it into a … | |
Re: can you run it from visual studio without crashes? | |
Re: Have you checked the output window in VS? Depending on the options you have selected in VS, some exceptions dont break to debug...look for "a first chance exception of type 'System.DivideByZeroException' occured in ..." in the output window. | |
Re: Here at daniweb, we dont mind helping others to learn, but the [URL="http://www.daniweb.com/forums/announcement61-2.html"]policy [/URL]is to help those who help themselves. A quick google search for "MYSQL JOIN" turned up [URL="http://dev.mysql.com/doc/refman/5.1/en/join.html"]this[/URL]. Have a go for yourself then post if you have any specific problems. | |
Re: Neither way is [B]wrong[/B]; either one is a valid method for passing values to a new object. Which one you use depends more on the situation. For instance, if you have a value that is manadatory or required whilst instantiating the object then placing it in the constructor ensures that … | |
Re: Please dont resurrect old threads, start a new thread instead. Aslo, you have posted an ASP.NET and VB issue in the C# board. You're more likely to get the help you need if you post in the relevant boards. | |
Re: OK, couple of things...the method given above is a good way to do it...you want to colour the rows when they are bound so use the RowDataBound event to do it. It saves you iterating through all your rows. Secondly, you are checking each row of the datagrid's [B]before[/B] you … | |
Re: There is also LastIndexOf() which searches from the end of the string working backwards. You can optionally provide a starting index: [CODE] string s = "test.test.test"; int LastIndex = s.LastIndexOf("."); // 9 //search includes character at startIndex so use LastIndex - 1 to avoid matching the same character int MiddleIndex … | |
Re: Without seeing code its hard to say with any certainty. I had a similar issue in the past and if i remember correctly i fixed it by resetting the ValueMember before i accessed SelectedValue: [CODE] combobox1.ValueMember = "CategoryID"; string selectedID = combobox1.SelectedValue; [/CODE] It was a while back and i … | |
Re: Are you using a streamreader? If so, have you tried checking the reader.EndOfStream property? | |
Re: You could set up a [URL="http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent(VS.71).aspx"]ManualResetEvent[/URL] to determine pause state. Without going into the nitty gritty (i'll let you do the reading :p), the ManualResetEvent has two states; signalled and unsignalled. If it is unsignalled, any time a thread calls WaitOne() on the event it will pause until the event … | |
Re: Can you be more specific: what does your image contain? ie, is it a white background with a rectangle on it which you wish to fill or is it an actual image that you need to search for a particular part of? | |
Re: First, you are correct in thinking that the count is used for inserting the next record. I would advise you look into the List<T> datatype though. Your code uses an array of strings and is initialised with a size of 10: [iCODE]string[] names = new string[10];[/iCODE] This means you can … | |
Re: You're entering an endless loop because of your while statement. You are setting j=0, then your while loop is based on while (j==0). If anything is incorrectly filled out then it shows the messageboxes, but it doesnt give the user a chance to change them. It gets to the end … | |
Re: You have pretty much answered your own question: "return me only values form cells [B]where table header is DATUM and Maloprodajna cena [EUR/L][/B]" Check out the [URL="http://msdn.microsoft.com/en-us/vcsharp/aa336760.aspx"]LINQ Where claus[/URL] | |
Re: depending on how you connect to your database, you could build the query dynamically. For instance, use a struct to populate the combobox with DisplayMember set to a user friendly string and the ValueMember set to the matching column name (eg Display = "First Name", Value = "fName"). Then when … | |
Re: Are you placing your ServiceClient() and StartListening() methods inside classes? CS1518 is caused by declaring something other than a class, delegate, enum, interface, or struct in a namespace. CS1001 is caused by using something other than an identifier where an identifier is expected; an identifier is the name you give … | |
Re: As ddanbe rightly pointed out, if you are in your final yewar you [B]must[/B] have come across some area of your studies that you really enjoyed or were really good at. The spectrum of projects is so vast that we could sit here doing all the brainstorming for you and … | |
Re: Path.GetExtension([I]filePath[/I]); can also be used to return the file type extension. If you have written a class then i expect your class has a method which reads the file and returns a thumbnail, since thats the behaviour you wish to alter, you can place the above code inside that method. … | |
Re: Just a note, if you want to be certain then use both methods...you can never be too careful with user input :p One of the big flaws with the KeyPress approach shown above is that it wont fire if they paste a value (valid or otherwise) into the textbox. How … | |
Re: I'm not sure why you are getting a warning about 'n' since it is assigned to then used in a comparison. But you should be getting an error about 'i' since it is never declared so it doesnt exist in the context that it is used. The error about your … | |
Re: Also, by setting the Owner to your main form it should call the closing events of the child forms when the main form closes. | |
Re: How they are grouped or ordered makes no difference to the app once it is compiled. The ordering/grouping is purely for your benefit whilst coding, and the benefit of those who may need to read your code in the future for review/maintenance/update. If you aren't coding in an environment that … |
The End.