|
Chk this out
http://www.codeproject.com/csharp/trayiconmenu01.asp
|
|
|
|
|
Hi,
I have an application where we type into a text box and this gets copied into 80 grid cells.
The application cannot keep up with a fast typist because of the number of copy operations.
Hence the Keyboard hardware event gets the keypress and sticks it in the keyboard buffer.
The TextBox.TextChanged event is then fired and copies the text into the grid.
But the TextChanged event gets behind the typist.
If only I could test the keyboard buffer to see if there are any pending keypresses, I could just ignore the TextChanged event as long as there were more keypresses coming through.
(unless the next keypress was a tab).
When we were doing DOS stuff we could do this and the VS-8 Console does have this facility.
In Windows forms there must be a similar facility, but the only thing I can find that seems similar is the .SendKeys.Send();
Does anybody know how I can check if there are windows forms keypresses in the queue?
Philip Best BSc(CompSc) AscDipEng(Elec)
C# SQL Software Developer & Electrical Engineer
mailto:phil@StrategyMap.com.au
www.StrategyMap.com.au
|
|
|
|
|
I am writing some window forms that involves with MDI...
There are 5 different forms...
Form 1 = parent form
Form 2 = Child Form (with 3 different buttons in it to activate other 3 forms (form 3, 4, or 5)
Form 3 = some stuff
Form 4 = Some stuff too
Form 5 = some stuff too too
ok What was going to happen is that the Form 1 would initially open up, while Form 2 as a child window to appear inside the working area of Form 1.
What I would like to do is that one of the button like Form 3 to be clicked. At this point, the Form 2 would close and show Form 3 child window inside the working area of Form 1.
Now the question is that can the parent window tell which button on the Form 2 child window was being pressed so the parent form can close the existing child form and bring up the appropriate child form? If so, how is this done?
I have developed the software in C# in the past but want to improve my software that would involve with MDI.
|
|
|
|
|
I'm doing a payroll system in C#.I have some problems in connecting databases.
My problem is how to make a single connection for the whole application and use it every where.
What will be the best practise of using connections because I'm doing OOP and I'm new to C#.
SO I hope some one will help me.
Thanks in advance.
Jay
|
|
|
|
|
I don't know what business requirement requires you having only one connection for the whole app, but it is not a good idea, especially since you can only have one reader per connection active at any given time. You would probably end up having a bottleneck, there.
The best is to use connection pooling. In ADO.NET, this is done for you. As long as you keep using the same connection string, ADO.NET recycles the connections for you.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 21:10 Wednesday 8th March, 2006
|
|
|
|
|
Hi Jay
What kind of application is that?
Ok.You can use Microsoft's Application Building Blocks. Building blocks is a class library and framework either you can use as it is or you can extend and customize as per your application requirements. Search in MSDN.Blocks are available for different functionalities like Security,DataBase,Error handling etc.Download and give a glance.
M.Sendilkumar
Thomson Corporation
|
|
|
|
|
Jay,
The preferred MS access method is to connect, retrieve multiple rows if possible, and then close the connection. As noted ADO Connection pooling is great for this. If you prefer working with embedded SQL you can definitely use ODBC in this manner: basically create an adapter and fill your dataset. Fundamentally you have to choose the direction you want to go with that makes the most sense to you. Bear in mind the more layers we add to "simplify" our logic isn't always the most straightfoward solution at the end of the day.
Now having a database proxy is another approach. Like the other cases I'd say you definitely need to ditch the one connection approach and support some "configurable" number of connections to allow for tuning. Ideally a proxy would have a multi-threaded or async architecture as the core einfrastructure. You can also build in security as needed. There are plenty of TCP/IP examples on Code Project that do this type of thing. All you would need to do is provide the Glue to make it ft within your world.
I personally use ODBC with MySQL and have found the development to be pretty easy. One of the hassles is the DSN, i.e. do you want to provision it in odbcad32 on each system or... provide some automated form of registry loading? Again here's a cat that has been skinned many times on Code Project.
I'll briefly mention OLE DB which is Micosoft's supplement to ODBC. Basically yet another access method but this one is not aimed at relational databases per se, but if you have to retrive from other data stores such as ISAM files, MS Office Files, then it' worth investigating.
Good luck
Mike Luster
CTI/IVR/Telephony SME
|
|
|
|
|
hi am called brian
first of its not good to use only one connection in your application especially if your application is going to be a mull-ti user.but if it is a single user kind then its ok.
the easiest way of creating connections is
1] go to the solution exp on the right hand side of of the V.S window
and double click on the on the properties link it will open a window that contains the application settings but you select the settings option
then create your connections that is any no you want
eg(connection,ConnectionString,Select the data source)
1)in the first dropdown you create the connection name
2)in the second dropdown you specify the connection type(Connection String)
3)you select the Data source
2]to access them you will use this the following code
//create a variable[connecition]
SqlConnection connection=new SqlConnection ();
//use it to implement he connection string
connection.ConnectioString=Properties.settings.default.ConnectionString;
try that out
|
|
|
|
|
Hi
I wanted to store word documents in my SQL server, so i have stored them as images. Now I want to be able to open these documents after clicking a hyperlnk in a datagrid.
Is this possible? Can someone show me how to do this?
Thanks for your help.
melissa
|
|
|
|
|
You need to make a proxy page that gets the data from the database and sends it to the browser using Response.BinaryWrite.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for replying Guffa!
So once clicking the link, the user is taken to a proxy page with the document?
|
|
|
|
|
Hi
I used Response.BinaryWrite to write to a blank webpage.
When i'm writing a jpg, it shows up great. but because i'm actually storing word documents as binary, i get all these funny symbols when i'm displaying it on a webpage. is there some other way to store word docs in sql server, and then being able to open/save them?
Thanks heaps!
melissa
|
|
|
|
|
Set the ContentType of the response according to the file type so that the browser can recognise it and choose the correct program to open it.
---
b { font-weight: normal; }
|
|
|
|
|
how to solve error below....
Error in File C:\DOCUME~1\GIGA-G7\ASPNET\LOCALS~1\Temp\temp_3797143f-fd73-493e-9e15-41986f48b6d6.rpt: Error in formula <record_selection>. '{Command.subCode} = WXES 3182 AND {Subject.subName} = Thesis AND (Lecturer.lecturerName) =abc AND {Command.subSession} = 2005/2006 AND {Command.semester} = 2 AND {Subject.faculty} = FSKTM' A number, currency amount, boolean, date, time, date-time, or string is expected here.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.FormulaException: Error in File C:\DOCUME~1\GIGA-G7\ASPNET\LOCALS~1\Temp\temp_3797143f-fd73-493e-9e15-41986f48b6d6.rpt: Error in formula <record_selection>. '{Command.subCode} = WXES 3182 AND {Subject.subName} = Thesis AND (Lecturer.lecturerName) =abc AND {Command.subSession} = 2005/2006 AND {Command.semester} = 2 AND {Subject.faculty} = FSKTM' A number, currency amount, boolean, date, time, date-time, or string is expected here.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormulaException: Error in File C:\DOCUME~1\GIGA-G7\ASPNET\LOCALS~1\Temp\temp_3797143f-fd73-493e-9e15-41986f48b6d6.rpt:
Error in formula <record_selection>.
'{Command.subCode} = WXES 3182 AND {Subject.subName} = Thesis AND (Lecturer.lecturerName) =abc AND {Command.subSession} = 2005/2006 AND {Command.semester} = 2 AND {Subject.faculty} = FSKTM'
A number, currency amount, boolean, date, time, date-time, or string is expected here.]
. F(String , EngineExceptionErrorID
)
. A(Int16 , Int32 )
. @(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.u(Boolean N)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
angela
|
|
|
|
|
I don't know if there is a way to do what I am about to describe so please tell me if it can or can not be done. I have done some searching but have found nothing similar to what I want.
As a simple example lets say I want to create a class to impliment linked lists. I want to have doubly and singly linked lists available, but the only public class I want to have is LinkedList. Ok, so a singly linked list is a subset of a doubly linked list, so there is nothing it can do a doubly linked one could not do. So you ask.. "eggsovereasy, just make a doubly linked list class and it can handle the singly linked ones". To which I respond that I think it would be clean were only the methods and properties pertinent to the type of LL you want made accessible.
So, the method to add a node in a DLL would look like:
Add(Node<T> prevNode, T data)
and a SLL like so:
Add(T data)
The two input method would not even be accessible if you set the "Type" property on LinkedList to "Singly".
I don't think this can be done, but it would cool if it could.
|
|
|
|
|
Make an abstract class with 2 static methods, and 2 classes deriving:
public abstract class LinkedList<T>
{
public static LinkList<T> GetDoubleLinked()
{
return new DoubleLinked<T>();
}
public static LinkList<T> GetSingleLinked()
{
return new SingleLinked<T>();
}
}
public class DoubleLinked<T> : LinkedList<T>
{
}
public class SingleLinked<T> : LinkedList<T>
{
}
And instantiate like this:
LinkedList<string> singleLinked = LinkedList<string>.GetSingleLinked();
LinkedList<string> doubleLinked = LinkedList<string>.GetDoubleLinked();
At this point, you have references to 2 objects that seem alike, but are not.
[Edit] I forgot to mention, make the constructors (any contructor) of the 2 derived classes, apply the internal modifier to them, so no external class can instantiate them directly, if this is what you want. [/Edit]
--------
"I say no to drugs, but they don't listen."
- Marilyn Man
-- modified at 22:10 Wednesday 8th March, 2006
|
|
|
|
|
Ok, forgot about the Add methods.
I think you Node class should be built the same way. An abstract Node, and 2 other classes, SingleNode, and DoubleNode.
So, you could have 2 methods in LinkedList<T>:
public abstract Node<T> GetNode(T data);
public abstract void AddNode(Node<T>);
Those 2 methods are overriden by the 2 other linked list classes, each override returning an appropriate kind of Node.
Single override:
public Node<T> GetNode(T data) { return new SingleNode<T>(data); }
Double override:
public Node<T> GetNode(T data) { return new DoubleNode<T>(data); }
It may sound a lot of work, but this is the only way to achieve the level of encapsulation you want.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 22:22 Wednesday 8th March, 2006
|
|
|
|
|
I'm trying to write OLE in-place activation server app in C#. Basically, what I want is that a user should be able to do Insert -> Object... in Microsoft Word and select my object there.
Has anybody done this? What interfaces do I need to implement? A non-C#/.NET-specific how-to will also do.
Thanks,
Nikhil
|
|
|
|
|
Hi!
How can I create a program that works just like a normal Windows Service for Windows CE (Pocket PC)?
I need the program to autostart when the operating system loads, and to do its work without making the user aware of it.
thanks!
/spAAwn
|
|
|
|
|
Hi. I need to iterate through every file in directory.
Geting files first into array with Directory.GetFiles() is too slow. How can I manualy iterate through files?
Thx
|
|
|
|
|
Go to this site:
http://www.libertyassociates.com/pages/Books.htm[^]
and download the source code for Programming C# 3rd edition (near the bottom of the page)
Ex 21-02 "Exploring files and subdirectories" in the Chapter 21 folder is a good example to study. And in general there's lots of useful examples in the book. (The 4th edition book covers C# 2.0.)
Kevin
|
|
|
|
|
Hey guys,
I think about to add a checkbox to the standard openfiledialog, but I didn't find a way to do that. Do anybody know if it's possible to "customize" the openfiledialog? And how?
Ralf
|
|
|
|
|
Make a class that inheriets the OpenFileDialog and add your checkbox and extra logic there...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
This could be possible if OpenFileDialog wasn't sealed.
There are some tutorials to add extra fields to the dialog but can't find them right now.
|
|
|
|
|
Thanks,
but I think it's not possible to inherit because it's a sealed class.
|
|
|
|