|
help on what? be more specific
IM PROUD TO BE A GMAIL;
|
|
|
|
|
Tom, thanks for response.
I need to make a program which can display the caller number when a phone call is recieved, having ofcourse the display modem attached to the COM port and the phone line, I have the modem (PC Caller ID).
Do you have any idea on how to show that?
Cheers
|
|
|
|
|
go to msdn or google hardware programming, im sorry i don't have time right now to do it my self
IM PROUD TO BE A GMAIL;
|
|
|
|
|
This is usually done through TAPI, if your modem supports it.
However TAPI and C# don't go very well together. You will be better off using C++.
However if you must try and use TAPI and C#, you are best off using this[^] as a starting point.
Michael
CP Blog [^]
|
|
|
|
|
Hi,
I just began learning c#, so I hope I am giving enough info with my question. I created a solution with two projects, in one I have an Mdi frame (with one namespace: boekhoud, and one class: frmContainer), in the other I have a child (with one namespace: ClientOnderhoud, and one class: frmClient). I set the parent-childrelation with
frmClient child = new frmClient();
child.MdiParent = this;
child.Show();
This compiles allright, so I can reference frmClient in my parent.
Now I would like to reference frmContainer in my child, I do this with
((frmContainer)this.MdiParent.MyConnection).Open();
It gives me the following error:
The type or namespace name 'frmContainer' could not be found (are you missing a using directive or an assembly reference?)
What should I do to let this work?
regards,
Stefan.
|
|
|
|
|
if projects are different then u have to:
1. add a reference to the Mdi Frame project in the child project. U can do this through the solution explorer >> Add reference >> and choosing the Projects tab.
2. Add a using statement at the beginning of ur child class file:
using boekhoud;
|
|
|
|
|
Ola Skynyrd,
I cannot add a reference to the mdi frame project, as it is no dll (I get an errormessage saying so if I try). I follow the rule 'an exe for the mdi, dll's for the childs'. With using boekhoud in my child cs I get 'The type or namespace name 'boekhoud' could not be found (are you missing a using directive or an assembly reference?)'
Any other ideas?
Gracias,
Stefan.
regards,
Stefan.
|
|
|
|
|
u need to have both projects under the same solution. Once u do this, u can reference projects through the projects tab even if they are .exe
Create a blank solution and add both projects to it. Then go to add references, and under the project tab of the Add References Dialog u will see that u can add a reference to the other projects of ur solution. DO NOT try adding it through the NET tab as u will get the exe error.
|
|
|
|
|
I have both projects under the same solution and I cannot reference the exe (mdiproject) in childproject. I get the errormessage stated in my previous mail. Any other ideas?
regards,
Stefan.
|
|
|
|
|
I'm sorry u are completely right...dunno what i was thinking about, cant reference .exe
I think ur best solution would be making ur container form implement an IContainerForm interface and include the Interface in your child dll.
Make any call to your parent MDI through the interface.
|
|
|
|
|
Thanks, this gives hope. Could you point me to or give a code-example?
regards,
Stefan.
|
|
|
|
|
Define a public interface with all public methods, events and properties that are not part of the base class Form of your fomContainer class and that u need to call from outside ur frmContainer's project. In your example we would have:
public Interface IContainerForm
{
SqlConnection MyConnection {get;}
}
Make ur frmContainer class implement the interface:
public class frmContainer:IContainerForm
{
}
When u need to call any particular method of your frmContainer instance from the child project, do it through the IContainerForm interface:
((IContainerForm)this.MdiParent).MyConnection.Open();
Obviously create the IContainerForm interface in your child project as u can reference this project from the frmContainer project and thus the Interface is available in ur containerform project.
Thats one of the reasons why Interfaces are used, it allows coders to share objects even before implementation is done. U are just sharing the public interface of your object that is basically all that u need when calling it from a different assembly.
I hope this solves ur problem.
P.D. Another solution would be to create a variable in youre childForm where u would store a reference to the parent's MyConnection. U could do this through a parameter in the childForm's contructor. This would be more code correct as you wouldn't be strongtyping the child's MDIParent and thus requiring that wherever u implement this class, its MDIParent must comply to certain conditions.
|
|
|
|
|
Thank you. I do not understand enough of interfaces to get my solution working yet, but found an interesting working solution at http://www.thecodeproject.com/csharp/SnapIn.asp with your pointer. It is not mdi, but easy adaptable. I'll spend some time on understanding that.
regards,
Stefan.
|
|
|
|
|
I have a picturebox control that I'm using the imagelist to draw one of two different images on. they're place in one of 24 different positions. the images draw great and look fine. The problem is if another window overlaps my picturebox, the images disappear. I'm new to C#, and I'm wondering should I be handling the form's paint event, or something different?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
try this in every handling for proposes problems this.refresh()
ByMindOnlyYouCanDoIt
|
|
|
|
|
I've made a class (CDot) that takes as its constructor's parameters two int's and an enum value that is defined inside the class. In my code when i try to make a new instance of the class, in the next call to add this to an arraylist, it crashes telling me "object reference not set to an instance of an object". I step through the code and put the object reference in the watch window, and sure enough, its values are all 0's. Any suggestions?
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hi again!
I've made a class (CDot) that takes as its constructor's parameters two int's and an enum value that is defined inside the class.
First, I would recommend not to define the enumeration inside the class. Well, it isn't as bad as a class defined inside a class but I'd still say it's confusing enough.
In my code when i try to make a new instance of the class, in the next call to add this to an arraylist, it crashes telling me "object reference not set to an instance of an object".
Would you mind sending an excerpt of your code?
Best regards
Dennis
|
|
|
|
|
It wasn't my class, it was the arraylist object that I didn't use 'new' on that was causing the problem. thanks.
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Hi,
i am using .NET Compact Framework with Visual Studio C# .NET 2003 for a little PocketPC application.
I want to use the Clipboard but it seems to be not available in .NET CF.
Also i cannot find the method .Copy() within System.Windows.Forms.TextBox.
Does anybody has an idea?
Thanks in advance.
Greetings.
Matthias Glemser
|
|
|
|
|
MSDN has this example code:
// C#
private void button1_Click(object sender, System.EventArgs e)
{
// Create a new instance of the DataObject interface.
IDataObject data = Clipboard.GetDataObject();
// If the data is text, then set the text of the
// TextBox to the text in the Clipboard.
if (data.GetDataPresent(DataFormats.Text))
textBox1.Text = data.GetData(DataFormats.Text).ToString();
}
// C#
private void button1_Click(object sender, System.EventArgs e)
{
Clipboard.SetDataObject(textBox1.Text);
}
Apparently, "Clipboard" is not in the .NET-CF, so maybe the second one wont work. I have no way to try this.
As for Copy() - According to my VS.NET-Help, there is no method "Copy()" within S.W.F.TextBox or S.W.F.RichTextBox.
Cheers
Sid
|
|
|
|
|
Hi Sid,
thanks for your reply.
Meanwhile I also found, that "Clipboard" and .Copy() is not available in the Compact Framework.
But i found a great solution at http://www.opennetcf.org. Have a look.
Matthias
|
|
|
|
|
Hi,
The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog. I have looked at the AssemblyVersionAttribute class, but I can't find any examples showing how to use it. Any help on this would be greatly appreciated.
Thanks,
Royce
|
|
|
|
|
Use System.Window.Forms.Application.ProductVersion
|
|
|
|
|
Hi Royce!
The AssemblyInfo.cs file contains attributes, such as AssemblyVersion, which I want to use programatically, as in an About dialog.
I suggest you should use the classes in the System.Reflection namespace rather than the ones from System.Windows.Forms because retrieving metadata from assemblies is exactly what the reflection classes were made for.
Version MyVersion = Assembly.GetExecutingAssembly().GetName().Version;
MessageBox.Show(MyVersion.ToString());
Best regards
Dennis
|
|
|
|
|
More generically (i.e. if you plan to use custom attributes or there is a possibility that you will be inspecting third party assemblies that may do so), you could do something like this:
object[] attribs = Assembly.GetExecutingAssembly().GetCustomAttributes(true);
That will return all of the custom attributes applied to the executing assembly either directly or through inheritance.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|