|
The reason you cannot (yet) edit it directly (evidently) is you probably haven't authored properties which interface the composite control you have built.
It's commendable you have gotten that far, actually. That's pretty good.
What I had in mind as sharing controls for all your pages -- in other words, use one set of controls built into your page control, and focus those on material of the focused/active page. That's just an alternate suggestion, and it is only pertinent if it would suit your purposes. But it is the most efficient way to go, because instead of deploying many controls, each of which do a given thing with given objects of one page, each of those controls is focused on the objects of the whatever number of pages... one page at a time of course, with the one page being the focused page.
|
|
|
|
|
Hello everyone,
I have created Two Windows Applications using C#. How can I call Windows Application "One" inside the Window Application "Two"?
Thank you so much for your help.
Khoramdin
|
|
|
|
|
What do you mean by "call"??
You can launch another application using the Process[^] class. "Calling" another application leaves lots of room for interpretation.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If you really want to windows applications to "talk" this is usually done through windows messaging. I have a sample article that uses windows messaging to tell a running application to show it self if it is currently minimized or on the tray. Here is the link:
http://www.codeproject.com/dotnet/windowsappsingleinstance.asp[^]
Hope that helps.
Ben
|
|
|
|
|
I assume you understand it is best to combine the applications, if practical. (You are the author.)
|
|
|
|
|
We have a bunch of adobe xdf files that are linked to pdf files and we want to programmatically convert them (output them) to tiff images. Anyone have a good tool recommendation? The few I have tested that work with PDF's fall flat when presented with xdf's!
File Not Found
|
|
|
|
|
hi all
does the transactionscope feature in .net 2.0 actually work with the filesystem or sending emails etc etc.?
i keep reading mixed blog posts.
i cant get it to work.
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew))
{
fileSystemManagement.CreateDirectory(folder);
userAccountManagement.AddUser(session.OriginatorUsername, session.OriginatorPassword);
userAccountManagement.AddUser(session.RequestorUsername, session.RequestorPassword);
emailGateway.SendOriginatorConfirmationEmail(session);
scope.complete()
}
|
|
|
|
|
Not in the way youre trying to use it, no. It won't back any of this stuff out if one of the lines in the transaction fails. It's primary use is in database transactions, not file system or email.
There is no way for the transaction to know how to rollback these operations if any one of them fails. You'd have to write you own wrappers, around each operation, that implements the ITransaction interface (I think!), and supply the code to commit and rollback those operations should the need arise. Although, there's no way to rollback an email operation...
You can find out how the entire Transaction namespace works and relates here[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thats what i was dreading. thanks for having a look for me though dave much appreciated
|
|
|
|
|
Hi:
I am somewhat new to C# and I am trying to create a class that my forms use. The SCICommunication class contains a method called SCIgetCal. See below for code. My goal is to get the calibration data (X0g, X1g, Y0g, Y1g, Z0g, Z1g) from this function and work with it in my form class RawData.cs. I call it in my RawData.cs by the following: SCI_Communication.SciGetCal(X0g, X1g, Y0g, Y1g, Z0g, Z1g); How can I do this? What am I doing wrong? Do I need to add any headers or anything to RawData.cs to use this function? Please help!
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.IO.Ports;<br />
using System.IO;<br />
using System.Threading;<br />
<br />
namespace Triax_ReVamp<br />
{<br />
public partial class SCI_Communication<br />
{<br />
<br />
<br />
public static int SciGetCal(int X0g, int X1g, int Y0g, int Y1g, int Z0g, int Z1g)<br />
{<br />
int readCal;<br />
int[] readXYZCalBytes = new int [9];<br />
<br />
COM_Port.SCIPort.Write("K");<br />
int readCalBytes = COM_Port.SCIPort.BytesToRead;<br />
if (readCalBytes == 9)<br />
{<br />
for (int j = 0; j < readCalBytes; j++)<br />
{<br />
readCal = COM_Port.SCIPort.ReadByte();<br />
readXYZCalBytes[j] = readCal;<br />
return 1; <br />
}<br />
if (readXYZCalBytes[0] == 88 && readXYZCalBytes[3] == 89 && readXYZCalBytes[6] == 90)<br />
{<br />
X0g = readXYZCalBytes[1];<br />
X1g = readXYZCalBytes[2];<br />
Y0g = readXYZCalBytes[4];<br />
Y1g = readXYZCalBytes[5];<br />
Z0g = readXYZCalBytes[7];<br />
Z1g = readXYZCalBytes[8];<br />
return 1;<br />
}<br />
else<br />
{<br />
X0g = Y0g = Z0g = 128;<br />
X1g = Y1g = Z1g = 189;<br />
return 0;<br />
}<br />
<br />
}<br />
}<br />
<br />
<br />
<br />
}<br />
}<br />
<br />
<br />
}<br />
Laura
|
|
|
|
|
You need to provide some additional information. Like what error are you getting? It would be helpful if you gave a slightly more comprehensive idea of what you are doing.
I have two comments:
1) In your first "for" loop you have a "return 1" statement. So you won't get to the rest of your code.
2) You may need to add references to the SCICommunications class. Visual Studio will complain if these references are needed.
Is SCICommunications class something you wrote, or is it from a third party?? I Googled it but I didn't find anything.
Best regards-
Squeaker
|
|
|
|
|
My goal in this project is to read in accelerometer data from a semiconductor board. The board responds to a protocol. If I write to the board a "K" it responds with 9 bytes of calibration data. The calibration data is as follows x, X0g, X1g, y, Y0g, Y1g, z, Z0g, Z1g. I am trying to create a class that has a built in function that writes a K to get the 9 calibration bytes. So that is why I wrote the class SciCommunications. I want to then call the function from a different class in order to get the calibration values in the RawData Class and other form classes. I am not getting an error but I am also not sure how to get the 9 calibration bytes in my RawData.cs. In my Raw Data I call it by doing
? = SCI_Communication.SciGetCal(X0g, X1g, Y0g, Y1g, Z0g, Z1g); Is this how I can get the 9 calibration bytes? What should I set the question mark to be, int or array? Hope this makes more sense!;P
Laura
|
|
|
|
|
Looking at your code for SciGetCal() it looks like it should work. Since this method returns an integer, you need to define a variable like ( int result; ) and then call your function like ( result = SciGetCal(...); }
1. Are you getting any errors?
2. Have you tried a normal serial communications program to see that the accelerometer board is working properly? HyperTerminal is the worst choice. If you need to get a simple one, I recommend Br@y Terminal. Free. And it doesn't install anything on your computer.
3. Do you have the serial port set up with proper baud rate, parity, stop bits, etc. ??
4. In Visual Studio you should put a break point when you start into your SciGetCal() method and step through the code line by line. This is pretty straight-forward since you only have a few lines of code. Are you using Visual Studio? What version?
5. Are you using Net 2.0??
Don't despair! Serial communications is tricky.
Regards-
Squeak
|
|
|
|
|
1. The following is the error that I am getting:
Error 4 'Triax_ReVamp.SCI_Communication.SciGetCal(int, int, int, int, int, int)': not all code paths return a value
I want it to be a boolean function.
2. I know that the serial communication is working, I have it working with a C++ program that we wrote previously which is very similair to this one and it works perfect!
3. I do have it set up properly: baud rate, stop parity, etc. I actually have this same code in my RawData.cs and it works. The reason I am trying to write a SCICommunication class is because I have multiple forms that will be calling the calibration function so I thought it would be better to have an outside serial class that has the function that I can call from all my forms.
4. I am using Visual Studio 2005 C#
I have attatched my code. I am trying to make it a boolean function, so that if it is successful in getting the calibration data it returns true, if it is not then it returns false.
Thanks so much for your help! I appreciate it!
<br />
public static bool SciGetCal(int X0g, int X1g, int Y0g, int Y1g, int Z0g, int Z1g)<br />
{<br />
int readCal;<br />
int[] readXYZCalBytes = new int [9];<br />
<br />
COM_Port.SCIPort.Write("K");<br />
int readCalBytes = COM_Port.SCIPort.BytesToRead;<br />
if (readCalBytes == 9)<br />
{<br />
for (int j = 0; j < readCalBytes; j++)<br />
{<br />
readCal = COM_Port.SCIPort.ReadByte();<br />
readXYZCalBytes[j] = readCal;<br />
<br />
}<br />
if (readXYZCalBytes[0] == 88 && readXYZCalBytes[3] == 89 && readXYZCalBytes[6] == 90)<br />
{<br />
X0g = readXYZCalBytes[1];<br />
X1g = readXYZCalBytes[2];<br />
Y0g = readXYZCalBytes[4];<br />
Y1g = readXYZCalBytes[5];<br />
Z0g = readXYZCalBytes[7];<br />
Z1g = readXYZCalBytes[8];<br />
return true;<br />
}<br />
else<br />
{<br />
X0g = Y0g = Z0g = 128;<br />
X1g = Y1g = Z1g = 189;<br />
return false;<br />
}<br />
<br />
}<br />
Laura
|
|
|
|
|
"not all code paths return..." means that you have some "if" statements and there is some possible condition where you can get to the end of your Method without encountering a "return" statement.
I can't follow the braces in your code, but you probably need a return somewhere. Look at your statement: if (readCalBytes == 9) If the condition is false then there is no return. I think a return belongs after your last brace.
You have to make incremental discovery.
1. Can you verify that the "K" command that you are sending out is actually being transmitted??? With a scope, a terminal program, or perhaps a LED indicator on the acc. board???
2. Did you try putting a break point at: readCal = COM_Port.SCIPort.ReadByte();
Squeak
|
|
|
|
|
This is the reason I always try to minimize the exit points from a method or function. The reason for the error message is that a return statement is missing at the end of the method. Put a "return false;" statement just before the last brace and your method will not have this problem.
Phil
|
|
|
|
|
By the way, Step 2 in my previous message; about verifying that the accelerometer board is communicating by using a known good terminal program is the most important step you can take.
Because if something is wrong with it or the cable, you can work for a year on your program and you will find no joy.
Joy is important!
Squeak
|
|
|
|
|
:-DI am just starting to learn C#. I would appreciate if anybody could suggest some beginners books to study. If you happen to know the author or the ISBN number that would help also. Thank you.
|
|
|
|
|
I'm also quite new to C# but I find "Programming Microsoft Visual C# 2005: The Language" by Donis Marshall (ISBN-10: 0-7356-2181-0, published by Microsoft Press) to be a pretty good reference. It isn't for the raw beginner but if you are familiar with programming and object-oriented concepts it is pretty good.
---
"No one would surrender to the Dread Pirate Westley."
|
|
|
|
|
See Richter's "CLR via C#" Second Edition. The online C# language specifications aren't a bad introduction (if you already understand OOP), and they're free. If you are dipping clear down to raw C syntax, it's not a bad idea to casually study early sources such as "The C Programming Language." But really, learning the language is the easy part. Practice requires learning the libraries -- and there isn't much help there but in library documentation.
|
|
|
|
|
I'd start with C# in Easy Steps.
Only $10, and very basic... but everybody needs to start with the basics, don't they? Gives information in a very clear form.
By Tim Anderson, ISBN 0-7607-5733-X.
(I found mine at a Barnes and Noble store.)
|
|
|
|
|
You know, for my money, the Troelsen book "Pro C# 2005 and the .NET 2.0 Platform" (ISBN 1-59059-419-3), published by Apress, is a good investment particularly if you pick things up quickly. It is a thick book but very well written.
Have fun,
Matt
|
|
|
|
|
Hi,
I have saved a DateTime object to a configuration file using the DateTime.ToString() method. I now want to read the setting and create a new DateTime object from it. How is this possible? I need both the date and time. I think I could store the day, date, month, year, hours and minutes but this seems overkill and would mean me reading many settings from my configuration file. Surely there is a better solution?
Thanks
|
|
|
|
|
Use the DateTime.TryParse or DateTime.Parse method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
If you want to store the value in a simple format, use the Ticks property to get an Int64 value. This can be used in the DateTime constructor to recreate the DateTime value exactly.
---
single minded; short sighted; long gone;
|
|
|
|