698 Posted Topics

Member Avatar for MARKAND911

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 …

Member Avatar for Geekitygeek
0
4K
Member Avatar for 0xCMD

Or similarly [icode]string path = System.Reflection.Assembly.GetExecutingAssembly().Location [/icode] returns the path of the file containing the exectable :)

Member Avatar for Geekitygeek
0
283
Member Avatar for jacg4

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 …

Member Avatar for Geekitygeek
0
5K
Member Avatar for judithSampathwa

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 …

Member Avatar for Geekitygeek
0
468
Member Avatar for Cap'nKirk

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 && …

Member Avatar for Geekitygeek
0
560
Member Avatar for kexxiena

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.

Member Avatar for kexxiena
0
96
Member Avatar for Geekitygeek

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 …

Member Avatar for Geekitygeek
1
100
Member Avatar for princesssuperst

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 = …

Member Avatar for Member 785500
0
2K
Member Avatar for Diamonddrake

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 : /

Member Avatar for Nivass
0
3K
Member Avatar for madoverclocker
Member Avatar for Dimonbak

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 = …

Member Avatar for Moorendeavors
-2
583
Member Avatar for Medalgod

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 …

Member Avatar for amir pr
0
1K
Member Avatar for eyes4u

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 …

Member Avatar for dilbertz
0
233
Member Avatar for mixelplik

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, …

Member Avatar for Geekitygeek
0
117
Member Avatar for jeeter19

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.

Member Avatar for Geekitygeek
0
91
Member Avatar for suranga_kas

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]

Member Avatar for Geekitygeek
0
158
Member Avatar for loliana

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.

Member Avatar for Geekitygeek
0
263
Member Avatar for Excalibur69

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 …

Member Avatar for Excalibur69
0
258
Member Avatar for chetanbasuray
Re: Age

You can look into [URL="http://msdn.microsoft.com/en-us/library/ms191250.aspx"]computed columns[/URL]

Member Avatar for ddanbe
0
101
Member Avatar for tibebu.s

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.

Member Avatar for Geekitygeek
0
265
Member Avatar for NOLK

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 …

Member Avatar for Geekitygeek
0
338
Member Avatar for GAME

If the MSDN didnt help, try [URL="http://www.daniweb.com/code/snippet241539.html"]my tutorial[/URL]. Its a simple intro to event handlers

Member Avatar for Geekitygeek
0
62
Member Avatar for konczuras

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.

Member Avatar for Geekitygeek
0
364
Member Avatar for WargRider

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 …

Member Avatar for Geekitygeek
0
101
Member Avatar for datapham
Re: C#

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 …

Member Avatar for datapham
-1
135
Member Avatar for Nocturn

Why can you not add the code? Can you be more specific? Have you used a toolStripDropDown item or is it a different control?

Member Avatar for Geekitygeek
0
287
Member Avatar for spawn2004

Can you clarify what part you need helpo with: retrieving the text from the second form or writing the text to the image?

Member Avatar for Diamonddrake
0
157
Member Avatar for thuyson

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 …

Member Avatar for thuyson
0
185
Member Avatar for thecurious
Member Avatar for jk451

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.

Member Avatar for jk451
0
177
Member Avatar for viveks.nair1988

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.

Member Avatar for Geekitygeek
0
78
Member Avatar for steveh44

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 …

Member Avatar for Geekitygeek
0
76
Member Avatar for khan17

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.

Member Avatar for Geekitygeek
-1
186
Member Avatar for laptop545

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 …

Member Avatar for Geekitygeek
0
166
Member Avatar for Potato.Head

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 …

Member Avatar for Geekitygeek
0
3K
Member Avatar for Ap0ca1ypse

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 …

Member Avatar for Ap0ca1ypse
0
9K
Member Avatar for swinefish
Member Avatar for swinefish
1
123
Member Avatar for Krytikal

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 …

Member Avatar for Diamonddrake
0
583
Member Avatar for milosz

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?

Member Avatar for Diamonddrake
0
223
Member Avatar for bornwith

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 …

Member Avatar for bornwith
0
91
Member Avatar for stryker4526

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 …

Member Avatar for stryker4526
0
100
Member Avatar for bunnyboy

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]

Member Avatar for bunnyboy
2
183
Member Avatar for OsheRono

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 …

Member Avatar for Geekitygeek
0
200
Member Avatar for ckjie

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 …

Member Avatar for Geekitygeek
0
245
Member Avatar for abubeker

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 …

Member Avatar for Geekitygeek
-2
125
Member Avatar for Rohith Reddy

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. …

Member Avatar for Geekitygeek
0
101
Member Avatar for Dimansu

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 …

Member Avatar for Geekitygeek
0
107
Member Avatar for DanielaCrisan

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 …

Member Avatar for Diamonddrake
0
151
Member Avatar for DAVe3283

Also, by setting the Owner to your main form it should call the closing events of the child forms when the main form closes.

Member Avatar for Geekitygeek
0
817
Member Avatar for DaveTran

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 …

Member Avatar for Geekitygeek
0
133

The End.