|
hi
for example i want a list of windows form name in a combo box ?
thnx
|
|
|
|
|
|
i dont using an MDI form ...!!!
|
|
|
|
|
What would the purpose of said list be? Are you wanting to control the forms such as showing/hiding them or some other type master/slave function between the forms?
Just making a list of winforms wouldn't do much without other interfaces between each form.
That being the case, how many forms are you using that you need a list of them?
If you have so many you need a list then you should in most cases be using a MDI parent...
|
|
|
|
|
i want to create a security pack that select a form name in application and set that a user can view or edit that form ... and save the name of form in database and in load of form with pass name of form to a sp an db find that user canVeiw Or Can Eidt
|
|
|
|
|
Hi,
you can get a list of all open forms from Application.OpenForms Property
you can create a list of all existing forms using reflection;
if you make them all inherit say MyFormBase and put them in a single assembly,
then interrogate that assembly for any type inheriting from MyFormBase.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
You need to use reflection and look at each class's base form name (System.Windows.Forms.Form or your subclassed form class name, if any)
|
|
|
|
|
I'm having difficulty using the Visio Drawing Control 2003 and the RichTextBox anywhere in the same application.
e.g.
public partial class VisForm : Form<br />
{<br />
public VisForm()<br />
{<br />
<br />
InitializeComponent();<br />
<br />
RichTextBox rttb1 = new RichTextBox();<br />
string rtf1 = rttb1.Rtf;<br />
rttb1.SelectedRtf = @"{\rtf1\ansi " + "Visible" + @"{\v " + "Hidden" + @"}}";<br />
string rtfText1 = rttb1.Text;<br />
<br />
}<br />
<br />
---<br />
}
First Scenario:
Initialize the RichTextBox BEFORE the Visio Drawing Control. Set rttb.SelectedRtf = @"{\rtf1\ansi " + "Visible" + @"{\v " + "Hidden" + @"}}";
rttb.Text will then be "VisibleHidden" which is correct. With the form displayed press CTRL+F to display the Find Dialog. The result is an AccessViolationException with the following message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
Second Scenario:
Initialize the RichTextBox AFTER the Visio Drawing Control. Set rttb.SelectedRtf = @"{\rtf1\ansi " + "Visible" + @"{\v " + "Hidden" + @"}}";
rttb.Text will then be "Visible" which is WRONG. i.e. the hidden text does not get set when the Visio Control is initialized before the RichTextBox. With the form displayed, this time pressing CTRL+F results in the Find Dialog being displayed with no problem.
Any ideas?
Thanks,
B.
|
|
|
|
|
I need to use lambda expressions or other way to
specify default query for dlinq entity type.
Code below causes compile error shown in comment.
How to fix ?
Andrus.
using System;
using System.Linq;
// '<' unexpected : attributes cannot be generic
[QueryAttribute<Supplier>(d=> d.Discriminator=="Domestics")]
class DomesticsSupplier {
public string Discriminator { get; set; };
public string Name { get; set; };
}
class QueryAttribute<TEntity> : Attribute {
IQueryable<TEntity> Query;
internal QueryAttribute(IQueryable<TEntity> query) {
Query = query;
}
}
Andrus
|
|
|
|
|
You can't fix it. Attributes are used at compile time. You can not use runtime values to determine the value for an attribute.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
This *is* pure compile time expression. It does not contain ani variables.
So it can resolved.
Andrus
|
|
|
|
|
There are two problems here:
1) Attributes can not be generic.
2) Even tho your expression can be resolved at completime, you can not use it in an attribute.
attributes are really picky about what you pass to them
for example, one might thing that something like [DefaultValue(Color.Red)] might be valid, since Red seems to be pretty constant... but it is not.
(My guess would be that even tho the structure of expression tree can be resolved at compiletime, the generic types that hold them are only available at runtime and this makes it an illegal value for attributes)
So you are out of luck on this one..
|
|
|
|
|
AndrusM wrote: This *is* pure compile time expression.
No, it's not. The lambda expression evaluates into a delegate.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
>>No, it's not. The lambda expression evaluates into a delegate.
Lambda expressions can also be Expression trees, so it is not always delegates...
Expression < func < foo,bool> > exp = foo => foo.Bar > 10;
(man the CP formatting is f..ed up)
|
|
|
|
|
Roger Alsing wrote: Lambda expressions can also be Expression trees, so it is not always delegates...
Then you would have to declare the parameter to be an expression, otherwise the compiler won't make code to build the expression tree.
As an expression is a generic type, I doubt that you can use it as a parameter in an attribute.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi All,
I am trying to import a txt file into MSAccess database and later into SQL server database using C# Code.This is the whole purpose.
I have two questions.
1)I have a txt file that has double quotes as field separator.This text contains more than 44lakh lines with morethan 10 columns.I want to import this into an MSAccess database using C# code.I will be having a blank database already created for this purpose.We just have to import the data into this blank database using C# Code.Is it possible,if so how?
2)This is basically a continuation of the previous issue. The file that we imported into MSAccess has to be now imported into SQL server 2005 database using C# code.I tried using BCP(Bulk copy programming),but unfortunatly its not working.So that option is closed now.How can we do this using C# code?Is it possible?
Many Thanks
|
|
|
|
|
If you must take it into access:
Why not use a text editor, something like gVIM with a :%s/\"/,/g then :%s/,,/,/g command and convert it to a CVS file and do a direct import?
Or you could do an indirect import by 1st going into to excel and picking " as your custom split char, but you MUST remember to import as text!
Not really a reason to parse this though C# code, as you are just going to make it harder on yourself. Remember the simplest solution is most of the time the better soluiton.
The only reason I could see doing this in C# is if you have to process these files many times a day or you wish to learn ADO.NET along the way. The second option doesn't seem viable if you already send Access data into SQL server, so why not modify or fork the program you have to parse the flat file directly into SQL server 2k5?
|
|
|
|
|
Hello everyone,
Two questions about IntPtr,
http://msdn2.microsoft.com/en-us/library/system.intptr(VS.80).aspx
1. does it mean in the internal SDK API implementation System.IO.FileStream, IntPtr is used to hold the native file handle?
2. when do we need to use IntPtr? We have easy to use class like StreamWriter, when and why do we need to use IntPtr?
thanks in advance,
George
|
|
|
|
|
Generally you use IntPtr when using PInvoke for accessing Win32 api calls.
|
|
|
|
|
Thanks Zoltan,
Got your idea. Is my understanding of item 1 correct?
regards,
George
|
|
|
|
|
Yes, check out the rotor source code here[^]
|
|
|
|
|
Thanks Zoltan,
Interested side. Does the site hacking some Microsoft code to produce the code on web (e.g. de-compile) or they just publish some public avaliable code on web?
regards,
George
|
|
|
|
|
No, it's not decompiled code, it is publicly available source from MS.
link[^]
|
|
|
|
|
Cool, Zoltan!
regards,
George
|
|
|
|
|
Hi George,
Microsoft's Rotor demonstrates a possible implementation of the .NET specs.
There is no guarantee the same code is used in any of the official Microsoft .NET releases.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|