DougW48
Posts
-
vb.net projects -
Convert string to booleanA good coding practice is to set your constant on the left side of your operator, so the compiler catches mistakes. For example:
if ( "true" == textbox4.text ) { }
will assure that you never are doing an assignment if you forget an = when you are intending to do a comparison. It's a good habit to get into. -
ODBC C#The app.config file is not supposed to be modified by your application for a reason. Why don't you take a look at the Enterprise Libraries Configuration Class instead?
-
New window in applicationIn your button's click event handler: frmYourForm oForm = new frmYourForm(); oForm.Show(); // Will show non-modal oForm.ShowDialog(); // Will show modal Good luck! - Doug
-
Form wont show any controlsAre you adding the controls dynamically? If so, are you remembering to add them to the form's control collection?
-
closing formsWhen you create your forms, keep the reference of that form in your calling class. This is the object that you'll want to close. When you create a new variable, you are just creating a new form object, and it is unrelated to anything you already have open. - Doug
-
HTML Content-typeIn the .NET 2.0, there is the new System.Net.Mail which I've been experimenting with. I cannot seem to come up with a way of changing the Content-type of my mail message to text/html. Even if I add this parameter to the MailMessage's header, the actual message's header comes through, and I will see 2 Content-type lines...the 2nd being text/plain, which puts my message back to normal text. In the System.Net.Mime class, when I create a new mime, I can specify the content-type in the constructor as a parameter...but this seems to be the only place I have access to do this. Is there a current way to set the Content-type in a mail message, or to set the BodyContentType to an already defined Mime variable? If there is no way, does anybody know if Microsoft is going to be adding this before the official release of VS05, and the 2.0 Framework? Thanks for the information!!
-
Handle pressing Enter or Tab key in DataGridTextBoxCreate a new class that inherits the datagridtextboxcolumn class. In this inherited class, you will have access to the textbox and can handle any events. Good luck
-
Application VariablesI can get a collection of system variables, and the collection of controls my form has in it. But, is there a method to get the collection of class variables, and possibly local variables to a function? This is for error-handling purposes, so as much information about my runtime that I can get, the better. This is a windows app, not asp. Thanks!
-
How would I do this?Most beginning programming and algorithm books have examples that teach how to do this. You basically start with your highest denomination change value ($5 bill maybe?) and go from there. Create a while loop while your accumulated changed is less than total change. Keep adding your current denomination until each unit is greater than your amount left to change...then go to the next lower value. When the loop ends , you'll have the exact change.
-
Windows Form and Message BoxIs the form supposed to wait on the message box to do something? If not, you can create a thread to show the message box. This will assure that your app will paint itself in the background. Make sure the messagebox is on top though.
-
returning values from a threadI believe threads must remain void. If you are certain that you won't interfere with variables, just set your calculated value in a class variable within the thread. If you aren't certain you have exclusive access to that variable, then put a lock on it.
-
Crystal Report Deployment Problem..I believe this needs to be the license key you get when you register the crystal reports.
-
could any one tell me how ?You can still do your tasks in a separate thread...I don't think he was suggesting that you create multiple threads for each block of code. Create one, let it do all of your tasks, just as your button event handler would have. At least this way you'll have control of your window. How long is your applications "hanging"? If it never stops hanging, then it's not an issue with overload, there's something in your code that is causing the application to hang. Step through it line by line to see exactly what is going on.
-
Default Application running pathBefore calling the file picker, store your current directory, then set it again afterwards. string sCurrentDirectory = System.IO.Directory.GetCurrentDirectory(); // DO YOUR FILE PICKING System.IO.Directory.SetCurrentDirectory( sCurrentDirectory );
-
Deleting a Row from a DataSet in a DataGridWhy can't you just use the dataAdapter's update method?
-
How and where to place returncode for a form or dialog ?If you call a dialog or form from the parent, that dialog or form won't be destroyed until the calling function ends, or you explicitly call the destructor. This means that any variables, or functions, will still be accessible. Just call a public function to get return values, or make the variables public. - D
-
Move buttonUse the setbounds function to change the location of a button on a form...
-
can threading is way in finding co-ordinate?Multithreading might not be the best implementation technique simply for determining the row and column numbers of your cursor. While it is nice to think of a thread as running concurrently with your main thread, in reality, they are still sharing processing space. If you do want to create a multithreaded application, then there are a few methods of going about this, some good, some really bad. First, you can start your thread when the application starts, and loop through it, constantly checking the cursor location. I think you'll find this is the worst approach you can take, as your thread will be interfering with your main application (and really you don't want a user to know it's even running.) Another approach would be to run a thread each time an event occurs which would possibly change the cursor location (such as a key press, or a mouse click.) These event handlers can simply start a thread, which handles finding the cursor location, and displaying it in your status bar (or wherever you want it.) This is better than the first approach, but I think an even better implementation would be to start one thread to check the cursor location, have it wait until an event is triggered, check the cursor, then go back into its waiting state until the next event is triggered. This way you don't have the overhead of constantly creating new threads to do the same task. Since this is purely a reader thread, I don't think you'll need locking mechanisms, but do a little research on it. If you do need to lock out the main thread, then you really aren't gaining much improvement over just calling a regular function when your events are fired. Good luck - Doug
-
finding the contents of a cell in a datagridgrdDisplayCustomers[grdDisplayCustomers.CurrentRowIndex,0];