|
The problem is not where you think it is. A DateTime value does not have a format, so it can't have an AM/PM indicator. It's when you convert the value into a string that it gets it's format. If you specify a format where the milliseconds are visible, you will see that they are there.
---
b { font-weight: normal; }
|
|
|
|
|
Can you connect to an Oracle Database when the form loads without executing a query? I would like to connect to the db first when the form loads and have a static connection while the application is running. When the user clicks a button, it simply performs a query and does not have to connect.
Any suggestions?
Thank you!
Apoc
|
|
|
|
|
Yeah, don't do it.
It's considered very bad practice to grab a very expensive connection license and hang on to it when your app isn't doing anything. Connect, query, release. It's that simple. There's almost never a good reason to hold onto a connection to the database for the life of your application.
Think of it this way. If you have 100 people using your app, but only half of them are doing any database work at any one time, do you want to spend $15,000 for 100 connection licenses or $7,500 for 50?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yea your right...
I fiqured out that the query was taking a long time and not the connection.
Thanks for the input!
Apoc
|
|
|
|
|
Hello,
I have a TextBox and a ListBox controls. I want to raise KeyDown event of the ListBox when user presses Up or Down Arrow keys from keyboard, on the TextBox.
How can I send the Keycode (key stroke) that user just pressed, to my ListBox from within KeyDown event of my TextBox?
Thanks,
Baris.
|
|
|
|
|
The best way to do this is to inherit a control from ListBox or TextBox, then call the protected method OnKeyDown. There are other ways as well, such as using SendKeys (not recommended, as it makes use of hooks, which can be blocked by certain anti-virus applications), or using the Win32 PostMessage.
I'd recommend inheriting from the control and calling OnKeyDown to artificially raise the event.
|
|
|
|
|
Aren't there any more easy way to do this?
If not, how can I inherit? Note that I want to use this new control at design-time. In other words, I must see the new control on my palette (Toolbox). And it must be like the list box exclude new method: MyKeyDown which I can call it from within any where of my code.
Thank you very much,
Baris
Notice: I am new to .Net and C#.
|
|
|
|
|
Inheriting is easy to do. Just create a class like this:
public class MyListBox : ListBox
{
...
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
}
public void FireKeyDownEvent(Keys pressedKeys)
{
OnKeyDown(new KeyEventArgs(pressedKeys);
}
}
As far as adding your control to the toolbox, you should be able to do it just by adding new item to toolbox, and when it asks you for the item, have it point to your dll containing MyListBox. I recommend you look at some of the articles here at Codeproject on how to design a good custom control fit for the toolbox.
|
|
|
|
|
badidi wrote: Aren't there any more easy way to do this?
You could also try using reflection to call the protected member on the control you want to access.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
What is reflection? Can you give an example?
Baris
|
|
|
|
|
I don't want only raising event. Also I want to make an effect to list box as if user pressed the down arrow key on it for example.
Baris
|
|
|
|
|
Hi i am having some trouble tryin to make sure the users of my web app (which im writin in c#) enter the correct types of data in the fields is ther someway to check if the data entered is a string when it should be and a number when it should be without doing a postback to the server, any ideas
Thanks in advance
|
|
|
|
|
|
Hello there,
I did Com+ component has many class all classes marked with autocomplet , Guid and some required and other requiredNew when i am trying to call methods from one of these classes it prombet me with this message
"The transaction has already been implicitly or explicitly committed or aborted
"
Please i need to know what dose it means this message.
Thanks for your time and help
Best regards,
Hoho
|
|
|
|
|
It means exactly what it says. You are trying to use a transaction that is no longer in use.
To tell you anything more than that, you have to provide some information on what you are trying to do.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your reply
I am trying to do some operations on the Sql database with this com+ like insert, update and delete but this operations works with transactions
Thanks
Hoho
|
|
|
|
|
I need to show dialog box sliding from beneath the title bar or a toolbar if there is any, in the form. I have searched in this website and saw dialogs sliding from the edges(top or bottom) of the form. How do I provide the same effect by making the dialog slide from below the title bar. How can I make the upper portion( that is yet to be shown by sliding) invisible in this case. Any ideas would be greately appreciated.
Thanks,
|
|
|
|
|
Perhaps you can try using a collapsible splitter as suggested in this article:
http://www.codeproject.com/cs/miscctrl/collapsiblesplitter.asp
|
|
|
|
|
Hai ekynox,
Thank you for the idea. I will try and see if that works for me.
VPMahank.
|
|
|
|
|
Does anybody have any telnet protocol in csharp other than what I found here. I would like to see more examples of telnet protocol.
|
|
|
|
|
I am trying to send serial data at a very high rate (18 bytes every 5 msec). I am using a multimedia timer to get the 5msec and the built in Serial port object in the .NET 2.0 framework. I am using the begin and end write calls to do asyncronous writes in order to keep up. This seems to be working, but when I look at the memory usage for my program it is gradually going up and when I run for over 5 hrs I use all of the system memory and my program crashes. Does anyone know if there are known issues with the Serial Port object or of any way to do this without causing the memory to go up? Any help with this would be great, thanks.
|
|
|
|
|
my bet would be more on your code design with the Async calls than a flaw in the framework. Make sure you arent starting multiple async receives for the same operation and you are accepting all your callbacks.
c#guy
|
|
|
|
|
Thanks for the response, I will look into it.
|
|
|
|
|
I am still not able to fix this problem. Here is the call to write the data to the serial port
serialPorts[3].BaseStream.BeginWrite(attArray, 0, 18,new AsyncCallback (myWriteCallBack),serialPorts[3].BaseStream);
myWriteCallBack is declared as
public static void myWriteCallBack(IAsyncResult ar)
{
System.IO.Stream mySerialStream = (System.IO.Stream)ar.AsyncState;
mySerialStream.EndWrite(ar);
}
Any help would be great! Thanks.
|
|
|
|
|
I have recently started to used Microsofts FxCop to validate code:
http://www.gotdotnet.com/team/fxcop/[^]
If you havent come across this application before, it is a code analysis tool that validates assemblies for conformance to Microsofts .NET Framework design guidelines.
So far prooved itself to be incredibly useful and in some situation informative. That being said there is one item is raises alerts on that I dont necessarily agree with.
If Ref/Out parameters are used FxCop raises the following alert:
"Using out parameters might indicate a design flaw. Although there are legitimate times to use out parameters, their use frequently indicates a design that does not conform to the design guidelines for managed code."
http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.32&url=/Design/AvoidOutParameters.html[^]
Each alert has an associated webpage (link above) which seems to inidcate that the main problem is that usage of ref and out is not widely understood and should therefore be avoided. Reading between this lines this says to me that if somebody working with the code is unlikely to understand usage then it should be avoided. IMHO if somebody is working on the code and is unlikely to understand then they should learn.
Anyway, I should step away from that rant, what is your opinion of using ref/out parameters?
|
|
|
|