|
Yes, but it's not simple. You need to extend the CurrencyManager class and override GetItemProperties to return the properties of the Type. You can do this simply by returning something like the following:
public override PropertyDescriptorCollection GetItemProperties()
{
return TypeDescriptor.GetProperties(typeof(MyClass), new Attribute[] {
new BindableAttribute(true) });
} Then, extend the Control classes that you want to data-bind and override the BindingContext property, return an instance of a derivative BindingContext that you must create. In your derivative class, override Add and when the BindingManagerBase is of type CurrencyManager , add your CurrencyManager derivative by calling base.Add with your type (which should copy information from the BindingManagerBase if available).
This should work, though it's untested.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is there a way to preview a report as you build it? I know you can do the viewer to show it at runtime but i was wanting to preview what it would look like as i'm building so i don't have constantly make changes to get it exactly how i want it to look.
thanks
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
win32newb wrote:
Is there a way to preview a report as you build it? I know you can do the viewer to show it at runtime but i was wanting to preview what it would look like as i'm building so i don't have constantly make changes to get it exactly how i want it to look.
thanks
I don't believe so. I think you need the full version to be able to preview during design mode.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Thanks for the reply. I guess it's like everything else its all about the money. I just figured since i paid the ungodly price for visual studio .net that EVERYTHING in it would be a full version guess not.
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
i do not know how to write out a program that allow to import data from excel files to SQL Server
Help Me.
Thanks
Mr Duc Linh Nguyen
|
|
|
|
|
try to connect to the excel file by using ole connection the read data to a Dataset or you can read data then write it to sql database be using sql conncetion
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Is this programming question? If you want to do it with SQLServer you can use Import and Export Wizard , follow it and it will do it automaticlly.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
hai there,
Is it possible to a C# .exe file to contact/communicate/get & pass value to another .exe files (may or maynot created using C# language)?.
except com con:-Dcept.
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
You can use TCP Sockets communication between the tow applications to do that
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
hai there,
thnaks for your nice information . See, i have an C# exe file which willl accept one integer value and it will store that value to an xml file. this is oneside. The other side is i want that value from my calculator(windows). How this communication is possible
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
Check out the FileSystemWatcher class
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
It's not... not by normal means anyway. The Calc application doesn't expose any kind of communication interface. It doesn't even take command line parameters.
RageInTheMachine9532
|
|
|
|
|
You can P/Invoke the Windows Management APIs and send Windows messages to applications, whether they were written in C/C++, VB, any .NET languages, or practically anything, actually, so long as they use the Windows subsystem. You do this using APIs like FindWindowEx to get an HWND (window handle) to a particular window (you can get the main application handle by enumerating the running processes with Process.GetProcesses then use the Process.MainWindowHandle from each if its a process you want to communicate with). One you get the handle to the control you want (most likely using the Windows class of the window/control), you can use P/Invoke PostMessage or SendMessage to send a Windows message (with the appropriate params) to it.
See the following article for an example and additional links to more information: http://www.codeproject.com/csharp/wmp_pinvoke.asp[^].
Also, read the Platform SDK for more Windows Management API documentation at http://msdn.microsoft.com/library[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm writing a couple of custom controls in the .NET compact framework.
I have two controls, one called "Target" derived from System.Windows.Forms.ContainerControl the other called "Arrow" from System.Windows.Forms.Control. I can successfully add Arrows to the Target's Controls collection.
I have overriden the OnPaint method on both controls and they work correctly as stand-a-long instances. What I want to know is the "correct" way of causing the Paint event of the target to raised the Paint events on each of it's contained arrows.
TIA
Phil
|
|
|
|
|
The WM_PAINT Windows message is not typically sent by an application (unless you want to force immediate repainting). It is send by the window manager (Windows in this case) when a window (which includes controls) needs repainting. If you want to force the child controls to repaint, then call the Refresh() method on the instance of your controls.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
first time
For the people.For the public.
|
|
|
|
|
Yes! CodeProject's posting interface really does work!
RageInTheMachine9532
|
|
|
|
|
Hi,
I am new to C# programming. I want to refer a DLL written in C++ (win32 DLL) in an application in C#. The Dll is in unmanaged code and my tester application is a C# application. I have read somewhere about using tlbimp to generate the metadata file. Can anyone tell me the process or any link which gives me information on this.
Kindly help.
Thanks
Vini
|
|
|
|
|
tlbimp.exe only works on COM servers with type libraries (typelibs). If you need to call native APIs that are exported from your DLL, you need to use P/Invoke.
See Interoperating with Unmanaged Code[^] in the .NET Framework SDK for the differences between CCWs, RCWs, and P/Invoke, as well as click "Search comments" above. It's been discussed in this forum more times than you can imagine and there are also MANY articles about both types of interop here on CodeProject and across the 'net.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
dear there,
i am a c3 programmer and i am new in com based programming. i want to know more about com. is it possible to create reliable COM Components in C# ?
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
Start by reading Nick's article, Creating a CCW for COM-enabled non-.NET Applications[^], and read Exposing .NET Framework Components to COM[^] in the .NET Framework SDK for more detailed information.
Can you create reliable COM components in C#? I don't know, can you? C# is a language, it doesn't create anything - you do. One of the goals of COM is to create a system where language is not so much an end as it is a means. You can write COM components in C++, VB6, and many other languages, as well as languages targeting the CLR (like C#) that make use of the interop services. It is fully supported and one of many viable means to writing COM components. How reliable it is depends on you.
The default shim, mscoree.dll, is also a factor, but I work with a heck of a lot of interop (both CCWs, RCWs, and P/Invoke) and have never had a problem with the shim itself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I got two questions about creating a package using c# & Windows Installer in Visual Studio .NET:
Question 1
I want to enable the user to choose during setup whether he wants to add a shortcut to the desktop or not. I did the following but it does't seem to work:
1. I added a two button RadioButtons dialog box to the Start section (User Interface) to enable the user can select whether he wants or does not want to add a shortcut to the desktop
2. I gave the ButtonProperty the name SELECTSCHORTCUT. If the selection is Yes, the value wil be 1 and if the selection is No the value will be 2
3. In the file File System menu I added a condition for the User's Desktop. The condition is SELECTSHORTCUT = "1"
Can someone tell me what I do wrong?
QUESTION 2
Scenario
1. I go to the User Interace editor and add a two button RadioButtons interface to the Start section (i.e. to enable the user to select whether he want to add a desktop shortcut during installation)
2. Now I want to add one more two buttons RadioButton dialog box to ask whether the user wants to use SQL server or MS Access database. The odd thing is that once I have used a dialog box, I don't seem to be able to add another similar type dialog box the installer. Somehow Visual Studio restricts using two times a RadioButtons Dialog during installation. Why is this and how can I resolve this? I really need to be able to have multple 2 button RadioButtons dialogs during installation
How is able to give an answer on the two problems raised above? Any help is greatly appreciated.
Lieperik
|
|
|
|
|
First, don't use a RadioButton like this: checkboxes are a better alternative (implicitly yes/no controls) and are more common with yes/no questions such as you're using. Using this method, your property is either undefined or null if unchecked, or defined as the constant value you pick if checked. Your condition then merely has to use the property name, like SELECTSHORTCUT . You can still check for the check value, but it's really not required.
Don't add this condition to the Desktop folder, though - it always exists and is assigned when the MSI runtime is loading. Add the condition to your actual shortcut item in the project's File System Editor window.
Finally, regarding your last question: I've been authoring MSI packages since MSI 1.0 beta and am currently on the 3.0 beta team. I've used about every major Windows Installer authoring package and not one is near as bad as those for Visual Studio (especially the add-in for Visual Studio 6 ). the Installer project is not meant to be a commercial deployment solution, however. It's good for deploying internal libraries, samples, and smaller projects from smaller companies. If you want real control, either learn and understand the MSI database and use Orca from the Windows Installer SDK, or look at commercial solutions like Wise Solutions[^] or InstallShield[^]. I personally and professional use the former, since it is much cheaper (and just as capable) and have provided unhindered access to the MSI database before compiling, where InstallShield for Windows Installer didn't add full exposure till version 4.0 (and it's MUCH more expensive).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Many thanks for your prompt reply. Your feedback is a great help. One last question if you don't mind:
You noted:
"Don't add this condition to the Desktop folder, though - it always exists and is assigned when the MSI runtime is loading. Add the condition to your actual shortcut item in the project's File System Editor window."
The strange thing is that there is no condition property for the shortcuts (I am using Visual Studio .NET). The only properties shown for the shortcut are: Arguements, Description, Folder, Icon, ShowCmd, Target, Transitive and Working Folder.
Without seeing the propery condition for the shortcut, how can I attached the condition to the shortcut.
Cheers, Lieperik
http://c-sharp.pagina.nl
http://c-sharp.prikpagina.nl
|
|
|
|
|
Yeah, I suppose you're right. I rarely use the Windows Installer projects in VS.NET, sorry.
You can set the condition for the file itself. Files are grouped into Components (guidelines state one executable per component, as well). Components are grouped into Features. Shortcuts are associated with a Component. So, the condition on the file is actually a condition on the Component (files don't have conditions - their components do). Since the shortcut is "tied" to that component, then the component shouldn't installed at all.
The problem is that you only want the shortcut optional, not the component. In this case, you must associate the Shortcut table entry with a new Component that uses this condition, and then associate that Component in the Features table of the MSI package. You can leave the KeyPath field of the Component table record null.
This requires that you install Orca from the Windows Installer SDK, which is part of the Platform SDK[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|