|
If you just want to show or hide a UserControl , than you can use one of the following:- Call
Show [^] to show the control, and Hide [^] to hide it again. - Set
Visible [^] to true to show the control, and to false to hide it again.
If you want to do something else, then please clarify it.
- Daniël Pelsmaeker
This is Linux country. On a quiet night, you can hear NT re-boot.
|
|
|
|
|
I want to know the complete information of a Database...
how many tables it have what r there manes...
each table have how many attributes and what r there names......
and want to show it in a treeview...like this
TreeView1.Nodes(0).Nodes.Add(snode)
using OleDbConnection
i execute query like this
select * from emp
Table.Columns.Count
Table.Columns.Item(count).ToString
through this i came to know the column number and name
but want to know full information about a database.....
Nothing ...........................................................
|
|
|
|
|
ADO.NET is a set of abstract classes. It isn't meant to provide you with everything, nor is the rest of the .NET Framework for that matter. If the database you're querying supports schema information queries, you can use that information (SQL Server does, see the SCHEMA_INFORMATION tables you can query, but in that case you'd be better off using the System.Data.SqlClient namespace for better optimizations for SQL Server).
If the database doesn't support schema information, you'll probably have to start P/Invoking a lot of the old ADO calls (note, that's not ADO.NET, just ADO). Because that, too, is an abstract API (though not quite as abstract), it might not get you everything you want to know either. Many times, though, the OLE DB provider can get you that stuff, but it is usually specific to the OLE DB provider, not to ADO itself.
-----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 didnt get the point pzl tell me the more speacific....
Nothing ...........................................................
|
|
|
|
|
There's far too much to cover in a forum thread. I gave you several pointers; you'll have to research this if you want to do it. Research is an all-too-important part of R&D.
There's plenty of information about ADO and various OLE DB drivers in the
-----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-----
|
|
|
|
|
Hi
I wish to assign icons to the various buttons in my application by referencing them from an icon library in which they are present. Please let me know how i can do that.
Thanks in advance
Regs
Sam
|
|
|
|
|
I just want to mention about one way doing this.
You can create a resource dll and embed your resources to this dll choosing the Build Action as Embedded Resource.
Then you can reach this icons as librray items.
Imagine yo have the icon test.ico in IconLibrary namespace and you want to change your form's icon.
System.IO.Stream st=assemblyExecuting.GetManifestResourceStream("IconLibrary.test.ico");
form.Icon=new System.Drawing.Icon(st);
System.IO.Stream st=assemblyExecuting.GetManifestResourceStream("IconLibrary.test.ico");
Read the icon as stream
form.Icon=new System.Drawing.Icon(st);
Then set the form's icon. Yo can also use System.Drawing.Bitmap(st) to convert the image to the bitmap.
Once you can get the image from the assembly you can use it in everywhere.
I Hope it helps
|
|
|
|
|
There's also a shortcut using the right Icon constructor, Icon(Type, string) . Like many other constructors (including many attribute constructors), the Type parameter is a type used for resource resolution. For instance, building on your example, lets say that you also had a class in the IconLibrary namespace. Specifying that Type plus "test.ico" in the constructor will cause the CLR to use that Type's namespace and append the resource name. This works a lot like relative paths in relation to directories on a filesystem or in a URL.
So, the same thing would work with less code (and amounts to the same thing):
Icon i = new Icon(typeof(IconLibrary.SomeClass), "test.ico");
form.Icon = i;
Of course, this only works if you have a Type you can reference in that namespace, but I thought I'd mention it because a lot of libraries keep these in the same directories as their respective controls (though not all). In those cases, using this approach is a little easier.
-----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-----
|
|
|
|
|
Many thanks....
You code and explaination is most helpful..i will try it out.
Regards
Sam
|
|
|
|
|
Hi all,
I'm having a stupid question, how can I get the integer that represent the enum?
public enum outputType
{
TIF = 0,
JPG,
BMP,
none
}
I would like to get the integer of this enum, somethings like
int num = (int)outputType.JPG;
how can I do it?
Thank you
|
|
|
|
|
azusakt wrote:
int num = (int)outputType.JPG;
That works for me, did you try this?
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Try this:
public enum OutputType : int
{
None = 0,
TIFF = 1,
JPEG = 2,
BMP = 3
}
[...]
int num = (int)OutputType.JPEG;
You can also use uint , long , char , ulong , byte , ubyte , decimal , double , float , and maybe even string . But I suggest int , since it doesn't put such a heavy load on the processor.
- Daniël Pelsmaeker
One fool can ask more questions than all the wise men can answer.
|
|
|
|
|
Actually, enum values automatically derive from int . And you can't use string (this is well documented in the Enum Type documentation).
Besides, this isn't necessary. The cast is the important thing, and so long as you don't overflow or anything like that. For instance, in your example, all the numbers are small and possitive so you could still cast to a short , long or whatever.
-----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-----
|
|
|
|
|
Hi All,
At runtime,I have created an instance for windows form and added controls in it.I want to save that form using Save dialog box.I need both resx and cs files.Is there any way to save the form created at runtime.
Thanks
Vimal
|
|
|
|
|
If you can create the form at run time then you can recreate it at runtime in the next session. Save to the file the data needed to create the form in the first instance and then when you load the file the data in it will describe the form to your program again. It can then recreate the form.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
To do it properly you need to use:
using System.CodeDom;
using System.CodeDom.Compiler;
you can use the methods in these classes to serialize your form and generate .cs and .resx files for it and also a .dll file.
It is not easy.
|
|
|
|
|
I have a application that neds to have a listening socket thread. I've created the worker thread but I'm not sure how to access my Windows Form controls from with in the thread. I'l like to update a TextBox with text from within the worker thread.
|
|
|
|
|
|
And just to avoid any possible problems, pay attention to how you use Control.Invoke from the worker thread in that article Mike gave you. This is a common mistake. Updating the UI from thread besides the main thread has "undefined" behavior. Sometimes it works, sometimes it doesn't, and sometimes it screws up your message pump (or, loop) so that some messages aren't handled correctly!
-----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-----
|
|
|
|
|
Okay here is what the problemo is ..
I am using MDI ... so i have this modal dialog box which opens up when the user clicks on a menuitem ... The person needs to enter some info into the dialog and click okay after that the values are passed to another form that is a MDI Child to the main form ... The problem is when the user clicks the close button the programm crashes ... I know why it does that because on the Okay button i inserted the code in the closing event so when the person closes the modal dialog with out filling anyhting in it .. it crashes which makes sence ...
I cant find a way to get around this problem ... The programm is a video lib managment system ... the modal dialog takes in the users code and opens the renting form ... Which is the mdi child ..
let me post the code it might help
<br />
CustomerCodeDialog cust == new CustomerCodeDialog();<br />
cd.ShowDialog();<br />
<br />
string customer_code = cust.getCustomerCode();
string custoerm_name = cust.getCustomerName();<br />
<br />
issueWindow issue = new isuueWindow();<br />
issueWindow.MdiParent = this;<br />
issueWindow.Show();<br />
And please i cant find a good tutorials on MDI form for C# on codeProject or any other web site .. any links would help me alot...
Sorry my wnglish isnt that great ...
Thanks
DaIn
|
|
|
|
|
If the inputs are validating, crashing the problem makes sense?!
You need to validate your inputs and gracefully warn the user or exit, depending on the circumstances (exiting, like in the case of 3 invalid password attempts or something). Crashing your program is not acceptable for clients!
Besides, never trust user input. Always validate input, even if it's just checking to see if input was provided. You should also put such commands in try-catch blocks so execeptions are caught and handled correctly.
One more thing, when using modal dialogs, you need to dispose them when you're done. So, after you get done grabbing values form your cust variable, call cust.Dispose() . Otherwise, the memory for the modal dialog (actually, this has to do with native handles used to display the modal dialog) won't be freed. This also helps keeps the memory footprint of your app down.
As far as MDI tutorials, I can't recommend any, but you should read the .NET SDK Documentation for the MDI-related methods and properties, such as Form.MdiChildren , Form.MdiParent , Menu.MergeMenu , and the like. It's not great, but it might give you a little more insight to some specific questions you might have. Otherwise, just ask the forum!
-----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-----
|
|
|
|
|
Oh, and as far as validating inputs, it's common practice to not let the user close the dialog until they've either canceled the dialog or enter the valid values. You should also get a DialogResult back from the ShowDialog call so you know what the user did:
DialogResult result = cust.ShowDialog();
if (result != DialogResult.OK) return; Or something like that. Then, in your form, make sure your OK and Cancel buttons have the right DialogResult property set (OK or Cancel), and that your form specifies the Form.AcceptButton and Form.CancelButton .
-----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 alot for the help
|
|
|
|
|
i need to develop on a network server here at work, but we can't get it setup right.
according to microsoft, you either need to be logged into the network as the same user as the asp.net process runs under, ... or ... logged in as an administrator of the box.
our admin says he can't set me up as admin, and i can not login as the asp.net process.
I am setup in the 'Debug' group on the server, but I still get permission errors.
anyone know any other way i can debug remotely with asp.net ?
|
|
|
|
|
It doesn't really matter which group you're in, so long as you have the debugging privilege (and just because there is a group named 'Debug', it doesn't necessarily mean these privileges have been granted). The priviliges should be configured in the Security snap-in for the computer, DC, or domain. The admin should also make sure that the Local Security Policy for the computer has the privileges assigned. Since domain privileges take precedence over local ones, using the Local Security Policy shows you whether a user or group really will have those privileges.
Second, don't forget to enable debugging in the Web.config file.
Finally, make sure the debugging tools are actually installed on the server. If you install the .NET Framework SDK on the server, I believe this is enough. In the VS.NET setup, there are some additional tools you can install remotely, but I believe these are only for DCOM debugging.
-----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-----
|
|
|
|
|