|
StreamReader reader = new StreamReader(yourStream);
String s = reader.ReadToEnd();
|
|
|
|
|
Has anyone written code for bluetooth communication ?
I need to transfer data between a laptop and a Pocket PC via bluetooth.
Any help would be appreciated.
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
hi all,
i ve to create an application in which i can open graphical files(created in c#) into microsoft powerpoint. is there any way by which i can achieve this.
im very new to c#, so any help/ideas/suggestions in this regards will be highly appreciated.
thanks in advance
p123
|
|
|
|
|
If you're new to C#, then first learn that and don't start-off with such a hard problem. Providing an image format handler is an incredibly daunting task that requires many, many COM interfaces (and in .NET, these have to be redefined in managed code) and registry entries. If you merely need to insert a well-known image format (like GIF, JPEG, PNG, BMP, etc.), then add the Microsoft PowerPoint typelib to your project (right-click on your project, select Add Reference, then click the COM tab) which creates an interop assembly. Then you can use the PowerPoint object model to insert an image.
Besides, it might not even be possible since PowerPoint may be configured to only handle image formats that it was written and compiled to understand. In this case, you have to create an image viewer COM component and get into OLE (object-link and embedding) to display it in PowerPoint. Again, this is a very daunting task that is even difficult for those of us that have been using .NET for the last couple years.
-----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 want to write a simple usb driver to read from a usb device, but I really have no idea how to do it. All I know is that it can be done through the Win32 API. Does anyone know how I can do this or knows of a sample I can view? Thanks in advance.
|
|
|
|
|
You won't want to try doing this from C#. Try the C++ forums.
|
|
|
|
|
currently, i would like to enhance the features of my system, which is
previously written system in c# by using several using several native
DLL.
however, the data structure in the DLL is rather complicated. they
have several array of struct re-inside struct, struct re-inside array
of struct, array of struct re-inside array of struct......
i know it is possible to write the wrapper class over struct. but, is
it possible to write wrapper class over the complex structure i
mention above? can anyone point me out more resource where i can get
related information?
someone suggested me to write an unmanaged C++ proxy/facade to interface between C# and the DLL. is it a good solution? can anyone point me out more resource where i can get related information on this?
thank you.
|
|
|
|
|
It is possible, though not always neat and clean. See the System.Runtime.InteropServices for lots of attributes, enumerations, and other classes to help create the structures with the right byte alignment and field marshaling, and to marshal the parameters for function calls. There is a lot of documentation the .NET Framework SDK that deals with these namespace elements.
-----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 have created a Panel onto which I am adding several UserControls. Each UserControl has a button which should delete the UserControl from the Panel. To each UserControl I'm passing a ref to the Panel so when the button receives a click event it can call this.panel.Controls.Remove(this). This however seems to work but when I quit the program it just hangs and I have located the problem to the Remove call. Is it illegal for UserControls to remove themselves from a ControlCollection? If so, how should I structure my code to avoid this situation?
As a related question, when Remove is called the UserControl is not visually removed from the Panel (unless I call Dispose on the UserControl), so what is the proper way of updating the Panel?
|
|
|
|
|
Controls can only be added and removed in the main UI thread. Make sure you're not removing a control in a different thread. It's also possible that something else has a reference to the UserControl (such as event handler). After removing the control have you tried disposing it and see if the problem happens?
To update the Panel , just call Panel.Refresh (inheritted from Control ).
-----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've running a project with dynamic generation of some kind of source code.
Therefore I'm looking for a .Net Template Engine which can combine Templates and some kind of objects to produce the code. The template engine velocity (which is for Java) would be the rights solution but I want to develop in C#.
I'm thankful for all ideas
Thanks
bernhard
|
|
|
|
|
There is a research version avaliable for the shared source implementation of .NET, I think over at http://research.microsft.com[^]
If you can wait, Generics (not quite templates) will be in the next version of .NET due first half of next year I think.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Anyone had a go at this in C#. I've seen some articles where they bind to the external calls, but I was looking more for how to do it with the features of the .NET runtime.
System.Threading.IOCompletionCallback seems to suggest its supported by the documentation is a bit lame.
As well as that the ThreadPool class does not seem to be up to scratch. 25 threads by default per processor seems a bit much.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
I am working with Tabbed Control, How can i assign a hot Key to Each Tab page. Itried normail way of putting & in heading but this does not work. Is there any way of doing so?
|
|
|
|
|
The tabs themselves are not controls and, thus, cannot receive Windows messages. The TabControl is the control and does this. You could handle the TabControl.KeyDown event and use a mapping that the TabControl uses to set the focus to a particular tab. The mapping could be fixed (Ctrl+1 through Ctrl+9 or something), or could use a mapping collection you could define. After you attach the event handler to the TabControl , it could be as easy as this:
private void myTabControl_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control)
{
if (e.KeyValue >= 49 && e.KeyValue <= 57)
{
int value = e.KeyValue - 49;
this.myTabControl.SelectedIndex = value;
}
else if (e.KeyValue >= 97 && e.KeyValue <= 105)
{
int value = e.KeyValue - 97;
this.myTabControl.SelectedIndex = value;
}
}
}
-----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-----
|
|
|
|
|
|
You know, it would've been faster to go to Dundas's site and look instead of waiting for a response here.
-----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-----
|
|
|
|
|
|
Infragistics has one (but their modular painting controls are incredibly inefficient under heavy loads), as well as ComponentOne. Of course, google will return you some other solutions as well.
-----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 Stewart wrote:
Infragistics has one (but their modular painting controls are incredibly inefficient under heavy loads), as well as ComponentOne. Of course, google will return you some other solutions as well.
Thanks. I've done a google and there are a few interesting products. I was hoping that maybe somebody here would have been able to tell me which are worth using and which not. Trying to find a decent tool comparision is very hard. I like the Dundas stuff, you know what you are getting.
The comments about Infragistics are useful though. The kind of stuff I need to know.
Michael
Blue canary in the outlet by the light switch
Who watches over you
Make a little birdhouse in your soul - They Might Be Giants
|
|
|
|
|
Hi all @ codeproject,
I've build a simple mdi application. It has 1 mdiparent, and
2 mdichild forms. The 1st child form is docked left, the second is
docked fill. The code to create the child forms:
form = new Form();
form.MdiParent = this;
form.Dock = DockStyle.Left; // or DockStyle.Fill for 2nd
The error:
When I click the left docked window, the second window(DockStyle.Fill) slides under the left docked window. Clicking the DockStyle.Fill window when it's slided under, makes it pop back to it's correct position.
What the hell am I doing wrong?
|
|
|
|
|
I believe the problem is the order that these forms are added. If the 'fill' window is added first and the 'left' window is added second, the docking does not work properly. You should add the 'left' first and then add the 'fill'. While this doesn't make much sense, we're dealing with 'Uncle Bill' so we do what we have to to make it work.
Good luck!
|
|
|
|
|
I have a set of business objects on a server, replicated on a client. The state of the client should always, after a work unit, or session, should be replicated on the server, i.e., when a user clicks save on the client after adding a new item, the Save method of the object persists its state to the client database.
I now want to transfer that state to the server, instantiate an object of the same class on the server, and invoke its Save method, thus replicating exactly the client operation.
Am I mad, or is this a workable solution? I am trying my best to keep all responsibilities and encapsulation, and avoid code in the objects knowing if they are client side or server side.
|
|
|
|
|
Idea 1:
Write a wrapper for the objects, which contains the same methods and properties. The client creates a new wrapper object. The wrapper constructor creates a local object, and an object on the server. Whenever the client calls a method of the wrapper, it calls this method on the local object _and_ on the remote object. If multiple users work with the same object, you have to synchronize the local object with the server object before every call.
Idea 2:
When the client opens an object, set a "locked" flag on the remote object. The client can work with the object, and when the user clicks "Save", it is replicated on the server and the "locked" flag is reset. The saved/unlocked objects will always be equal.
|
|
|
|
|
My problem here is that the client normally only connects to the server once a day, normally by a dial-up, so the wrapper can't call methods on both objects at the same time. My biggest issue is the creation of the remote object on the server after it has been created on the client.
Once it exists on the server, by whatever means, I can just execute method calls on the server at the same time as the client.
|
|
|
|