|
Opps Sorry I posted as Anonymous
**DAN**
|
|
|
|
|
OK, Today I have my Head screwed on. I got it. I just created a seperate method for creating the contextMenu.
Thank you for your help Heath
**DAN**
|
|
|
|
|
How can clear the DOS Console from a C# console application.
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
This will be possible in either .NET 2.0 or Longhorn (no sure exactly which since release details are still sketchy) with Console.Clear , but for now you have to rely on other ways. One article here on CP presents such a way: http://www.codeproject.com/csharp/winconsole.asp[^].
There's also a programmatic way, but you'll have to P/Invoke some native functions: http://support.microsoft.com/support/kb/articles/q99/2/61.asp[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
but with this method, you give up your portability
antoher method is, when you fill up the Console with
\n (i mean the escape sequence)
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
|
|
|
|
|
Portability is often not possible anyway. Say I write a console app to manage the NICs in the machine - unless I add an abstraction layer, managing information on the NICs / in the OS is platform-dependent. Even with the code I gave, one could always abstract that, too.
In any case, your idea works, it just isn't technically clearing the screen (this is most notable when you have a larger command/output buffer for your prompt and scroll).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
[rant]
That decided that a BarBreak creates a horizontal bar on a MainMenu, but a vertical bar on a ContextMenu???
What if I want a horizontal separator on a context menu???
![/rant]
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
|
|
Marc Clifton wrote:
That the "-" now means "seperator".
Oops I thought -- is the seprator and it's different from a bar break?
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
ive might have missed the idea of what you are doing
but whats wrong with setting the text to "-" on the menu item? (since this always renders a horizontal separator)
//Roger
|
|
|
|
|
Roger J wrote:
but whats wrong with setting the text to "-" on the menu item?
OK, so who was the idiot that got rid of the Separator concept, so I have to remember stupid tricks like that???
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
is it possible to make a program in c# that doesn't require the .net framework installed?
I've written a program in c# and visualstudio.net and I want it to work without any trouble on all computers, but when i try to run it on my other computer it says that the .net framework isn't installed..
is it possible to include the framework parts that are needed in the program..
or is the only way to go to rewrite the program in c++?
|
|
|
|
|
Running C# without the framework is like having a steering-wheel without a car attatched....it makes a nice projectile, but won't get you far.
You can place the .NET framework inside your setup app, but it does increase the size of it by 20mb.
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|
|
C# compiles to IL (like all .NET languages) which is JIT'd and executed by the Runtime which managed the memory, code, bindings, etc., hence being called "managed code". What do you think is managing it?
Read this for more details: http://radio.weblogs.com/0105852/stories/2002/04/21/itsTheRuntimeStupid.html[^].
If you want a runtime-independent application, learn C/C++ since every modern (and even most old) OS is built on top of it and already includes the necessary runtimes.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
A very generic question that is. i would like to know how i would go about launching an application with C#. And if it is possible, how could i manage it in simple terms (execute/restart/stop) not, managing it's contents etc.
Thanks in advance
|
|
|
|
|
System.Diagnostics.Process.Start("C:\Windows\Notepad.exe");
Should do the trick. As for controlling the app, you will have too look in the articles on CP, I'm sure we've got some here.
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|
|
Thanks, i already dug some articles out, not exactly what i was looking for but, they'll get me to the point i need.
|
|
|
|
|
i am populating combobox on keypress event of the combobox.
when three character are pressed, i get for the text so for written in the combobox and search the text in the database, after searching if results are found, combo-box is clear & populated again using a for loop ( since the result after the database query is an ArrayList).
Next i do this combox.DroppedDown=true,
Now here comes the problem, the selected text (i.e the characters that are written in the combox box are cleared), i have expilicity set the combo-box text.
other problem is when combo box is in dropped down mode, the first element get selected even if i don't want to .
please help if any one has solution
|
|
|
|
|
This is the behavior of the ComboBox common control, which the System.Windows.Forms.ComboBox class wraps. In order to override this sort of functionality, you should read about the ComboBox common control (in the "User Interface Design and Development" section of MSDN, under "Windows Controls") and extend the ComboBox class in .NET in order to override the WndProc method and handle the notification messages yourself. Some of this might be possible using managed events, but not everything always is.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm a newbee in C# (barely 3 wks old). The problem is that I have two tables in two different databases running on different machines, I need to join these two tables in a query using a database link. Haven searched my libraries thoroughly. The best I came up with was to write the query in a stored procedure, which I called from the program (this is a very slow solution like you'll probaly guess).
The VC#.NET documentation has extensive support for database programming which I have explored...but where is the database link object. Please help needed urgently.
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
There's no such thing as a database link object. There is connection classes like SqlConnection , but unless you plan on joining these results yourself, you can only use one in certain objects like a SqlDataAdapter . There is ways to link databases together in some RDBMS's like SQL Server. You can then use a stored proc or a view to query both databases using a syntax like "database.owner.object". In most cases, leaving this on the server provides faster access and centralized management of the query and the database links. You could then write a view like so:
SELECT A.Name, A.Birthday, B.AccountID
FROM Table1 A JOIN db2.dbo.Table2 B ON A.ID = B.ID where db2 is a linked database.
You can find more information about this in the documentation for your RDBMS like SQL Server. I also suggest you move this to the SQL forum if you continue this way.
Otherwise, you'll need two SqlConnection objects and two pairs of SqlCommand and SqlDataReader objects (note, I'm assuming SQL here because many lower-end RDBMS's don't support database linking that would use System.Data.OleDb classes). Then you'll have to read the results and programmatically join these together. This will most likely be much slower and more risky that allowing the database server to do so.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks. I have already tried the first approach (joining the tables in a query that resides in a procedure on the server-side)- this turned out to be quite slow anyway. What I need is how to do this using either the OleDb or SqlClient (programmatically). Help still needed.
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
The client-side programmatic way is not going to be easy, and most likely will even be slower (think about it - an RDBMS server is typically beefed up to handle many queries where client machines usually aren't - and they both have to go through roughly the same procedure to join the results; the RDBMS is also better optimized for such operations).
The easiest way (and similar to an action plan that an RDBMS would generate) would be to use two SqlDataAdapter s (I'll be using classes from the System.Data.SqlClient namespace, but you most likely can do this in the other similar namespaces like System.Data.OleDb ) with two different SqlConnection s to get a couple of DataSet s. Then enumerate the rows in one of them, find rows to join in the other (see DataTable.Select ), and put them in a different table (which you can add programmatically - see the documentation on the DataSet class). You could also make a new DataSet to hold both tables - or the cross product, whatever suits your needs.
You can search CP and google for examples, but I doubt you're going to find much because an RDBMS on a decent server is going to handle this a lot better than a client.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath, thanks for being helpful on this. I hope some database programmer out there has the way around this problem. I have a project in which the tables and every other database objects must be created programmatically(including the database link) and then written into two different databases and also queried later within the program. For now I'll just keep trying. Once again THANKS.
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|