|
Converting from VB6 to C# might be in the same league as a root canal. Here is my thought on how to do the code you specified...
(1) make a reference to SJPhoneXMLApiDemo.dll in the Solution
(2) the c# code may be something like:
void StartConnecting()
{
TextState.Text = "Initializing: stage 1";
SJxmlApiConnection ApiConnection;
if (ApiConnection.Initialize("SJPhoneXmlApiDemo.dll")))
{
ToConnectingState();
}
else
{
ToConnectfailedState();
}
}
Not sure if this code will compile, but it would be my first stab at the problem...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Well at least I can say that I was thinking the same thing when I made my attempt. My first try at making this work looked exactly like your code If I try to reference the DLL I get an error that it's not a valid COM object and when I try to run the above code I get a COM exception error. I did try to let VS convert the VB6 version of this app to C# and that was just a nightmare. Are there things you just can't do in C#, like this?
|
|
|
|
|
Hi,
I had been trying to set up my C# program to be a .dll for my C++ project. I had followed the guide from this site (http://www.csharphelp.com/archives/archive281.html) to package it as a Com Object. It worked in all regards, except that when I try to make a pointer to the exported class (public class DBCOM_Class : DBCOM_Interface in example), the named class is not seen by the C++ project. I can see/make pointer to the interface and the event handler, however the class itself doesn't show up in the list of members of the exported namespace (Database_COMObject) in the example.
What do I do wrong?
wbr,
Victor
|
|
|
|
|
I have a ToolStripContainer with four ToolStripPanels. I need to remove this container from the project without loosing the menus and toolbars I have contained within it.
I have been searching for two days trying to find any info on how to save the docked toolbars by serialization. I then decided to remove the container. I found lots of info on creating the container but nothing on serializing the controls or removing the ToolStripContainer from the project!
Any help is appreciated.
Mark
|
|
|
|
|
If you remove the container, you'll lose it's contents. Where were you hoping they would go ? You'd need to replace them with conventional menus and toolbars, and I don't think there's an automated way to do that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thought so. I dropped the MenuStrip, ToolStrips (2) and a StatusStrip on a form. Later I added a ToolStripContainer (with four panels). Didn't like it so now I want to remove it.
Mark
|
|
|
|
|
need to know hw 2d dwt wrks for images hv a class in 1d form.
|
|
|
|
|
u shd wte cplet stcs or we dnt undsnd u
modified 12-Sep-18 21:01pm.
|
|
|
|
|
There's a full 101 key keyboard in front of you. Use it.
TXT speak is frowned upon here because it makes your posts difficult to understand. All I could pick out was something about 2D drawing?
|
|
|
|
|
Dave Kreskowiak wrote: There's a full 101 key keyboard in front of you. Use it.
Hey, the subject of the post is "compression". Maybe he's proposing some sort of text compression algorithm. Lossy, obviously...
Anyway, your guess is as good as mine...
Sean
|
|
|
|
|
|
how do can i open excel charts(in Excel 2007)in .net with C#?
|
|
|
|
|
The Microsoft Tools for Office give you the ability to interact with Office.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I generally use this method to update buttons cross-thread, but ToolStripButtons don't have the InvokeRequired property.
delegate void UpdateStartDelegate(bool newState);
private void updateStartButton(bool newState)
{
if (startButton.InvokeRequired) // is cross-thread update
Invoke(new UpdateStartDelegate(updateStartButton), new object[] { newState });
else
startButton.Enabled = newState;
}
Is there an easy way to do the same thing with a ToolStripButton?
|
|
|
|
|
((Control)btn).InvokeRequired
only two letters away from being an asset
|
|
|
|
|
All ToolStripItems (suach as ToolStripButton) are only of type Component. They don't inherit from Control.
Regards.
|
|
|
|
|
You're correct, my mistake
only two letters away from being an asset
|
|
|
|
|
use a synchronous calls using a timer
|
|
|
|
|
I apologize for posting on an old thread, but I had the exact same question, and there did not seem to be an answer to this one. Someone mentioned using a timer, but my cross-thread could take several seconds, several minutes, or several hours.
I think I came up with an answer, so for future searchers I decided to post. I would test the ToolStrip that contained the button. This code seems to work to enable a toolstripbutton when a thread is done.
public void Enable()<br />
{<br />
if (toolStrip.InvokeRequired)<br />
{<br />
EnableButtonCallback d = new EnableButtonCallback(Enable);<br />
toolStrip.Invoke(d, new object[] { });<br />
}<br />
else<br />
{<br />
button.Enabled = true;<br />
}<br />
}
|
|
|
|
|
Hi,
I am designing a paint brush type program…..for drawing area where I can draw something then I used pictureBox…..like as
Pen p = new Pen(Color.Red, 5);
g = pictureBox2.CreateGraphics();
g.DrawEllipse(p, e.X, e.Y, 5, 7);
in this program I can draw anything but when I want to save this drawing by the help of this command: pictureBox2.Image.Save(saveFileDialog1.FileName);
then an error occur : “NullReferenceExpection was unhandled !”
“Object reference not set to an instance of an object.”
I need your help………can anybody solve my problem
Thanks
|
|
|
|
|
I'm guessing that Image is null. From what I remember if you want to save what's been drawn you need to do it another way, can't remember off the top of my head.
|
|
|
|
|
I am constantly amazed at what people do with picture boxes.
zeeShan anSari wrote: g = pictureBox2.CreateGraphics();
This does one thing and one thing only. It allows you to draw something temporary on top of a picture box. What it plainly does not do, is change the image inside the picture box. You should never do this, unless you're drawing a rubber band ( something you want to lose ). If your form is invalidated, what you drew will be lost.
What you need to do, is create an actual image, draw on it, and put it into the picture box. As someone else said, Image defaults to null, you did not change it, it is still null.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
solution is here:
Bitmap bmp = new Bitmap(pictureBox2.Width, pictureBox2.Height);
Graphics g = Graphics.FromImage(bmp);
Pen p = new Pen(Color.Red, 5);
g.DrawEllipse(p, e.X, e.Y, 5, 7);
pictureBox2.Image = bmp;
|
|
|
|
|
Can anybody send me the solution how to get Max value from a nodelist in C#. 4002-9568-F47910C94602}</CreatedBy>
<EffDate offset="">3/1/2007</EffDate>
<Effective offset="">3/19/2007 9:43:57 AM</Effective>
<Expiration />
<Id>{1A1678C9-8E9F-4779-B794-BB8B9B44067B}</Id>
<Modified />
<ParentId>{153EB717-9DB0-4DEC-9951-F38E0A6F8800}</ParentId>
<PolicyTermPremium offset="1405.00">0</PolicyTermPremium>
<Process offset="">3/1/2007</Process>
<ProRatedChangePremium offset="1405.00">-1104.33</ProRatedChangePremium>
<Status offset="">Cancelled</Status>
<SuppressPrint />
<TotalProRatedChangePremium offset="1405.00">300.67</
TotalProRatedChangePremium>
<Type offset="">Pro-rate</Type>
<UnitNumber>3</UnitNumber>
<VersionedId>{1A1678C9-8E9F-4779-B794-BB8B9B44067B}</VersionedId>
file:///C|/Documents%20and%20Settings/mdowdy/Desktop/Packaging/Interfaces/PolicyCancel.xml (56 of 57)4/17/2007 1:52:18 PM
file:///C|/Documents%20and%20Settings/mdowdy/Desktop/Packaging/Interfaces/PolicyCancel.xml
</Transaction>
</Policy>
Since <UnitNumber>3</UnitNumber> it is maximum my <Action offset="">Cancel</Action> and
<Status offset="">Cancelled</Status> tells me that my Transaction is Cancelled.I need this "Cancelled" word.
|
|
|
|
|
You got so wrapped up in providing more info than we might look at, that you forgot to ask your question...
|
|
|
|