|
(c/s c#)
In the mian window, I create a combox that is named axPageLayoutControl1,
I want to use the combox in the child wondows, how can I do ?
in the child wondows, I write it :
if(axPageLayoutControl1.Text!=null)
{
........
this.IbIPrinterName.Text=pPaper.PrinterName;
}
but the axPageLayoutControl1 could not find.
Give me a example ,please
|
|
|
|
|
Hello,
The point is that you can only have access to public members of your mainwindow from your childwindow.
But only if you have the reference of the mainwindow in the childwindow.
Using static fields is not good style, for that problem, but can be usefull in other tasks.
You could pass the reference of mainwindow to the childwindow over the childwindows constructor, or a property.
As it i bad style to make the whole combobox public, you should create methods or properties in your mainwindow, which return the informations you need.
Like:
public string PrinterNameText
{
get
{
if(axPageLayoutControl1!=null)
{
return axPageLayoutControl1.Text;
}
return string.Empty;
}
}
An other solution would be, using delegates.
There you have the luck, that Colin Angus Mackay wrote this fine article[^], which will help you.
Actually, there is also the child to parent connection over the reference, explaint.
All the best,
Martin
-- modified at 1:54 Friday 6th July, 2007
|
|
|
|
|
Either change the access modifier from private to public
or implement a property.. that get/sets the combobox control
|
|
|
|
|
I am trying to make a generic form that has a datagridview on it. I want to be able to send in multiple types of collections, the type will be determined at runtime, to the form to be bound to the datagridview. Im guessing I need to use generics for this, but Im not sure how to do it.
thanks 
|
|
|
|
|
No, you probably want to use IEnumerable, or some other interface that is common to collection classes.
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 tried using IEnumerable<object> but I could not convert List<> to use it. Am I doing something wrong?
|
|
|
|
|
IEnumeration is an interface that your collection has to implement. There are plenty of samples on implementing IEnumerable.
Once you've done that, you can simply use foreach to iterate over the collection.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Are there any decent memory debuggers out there that will work in a mixed C# and C++ (both managed and unmanaged) environment? I'm helping a collegue track down some problems in his code, the hunt started for a reason that the EngineExecutionException was being randomly thrown, but several AccessViolationExceptions were found after removing some "catch (Exception ex)" lines were removed, so we're tracking down these access violations first, thinking that they are perhaps some of the reasons behind the EngineExecutionException.
I've used BoundsChecker in the past with great success, but it looks like this as well as pretty much every tool I'm finding is for unmanaged C/C++ only. Managed code "shouldn't" have these problems, but unsafe code blocks are used quite a bit in an effort to speed the program up (speed is very imporant to this program) - and it's looking like the AccessViolationException isn't being thrown on all of the incorrect accesses, so we're getting some corrupted memory (even had a file get corrupted that was only open for read, still wondering how that happened).
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
I'm working with VS2005, i create Crystal report bind it with DateSet and inside the form i put crystalreportviewer to display report data, after running project i foubd that crystal report is empty but DataSet has data inside it, i tried many time to check why this happend but i can't find any solution (note: i made DataSet with wizerd and crystal report too, so i didn't write any code).
please any one know why this happend please tell me
|
|
|
|
|
Hey,
Does anyone know of a way in .NET (C#) to use a key that will decrypt a something but not encrypt it. I looked at RSA,DSA, and TripleDES but when getting the private key it includes the public key as well. Does anyone know if this is possible or would I need to rethink my design.
Thanks
--
John
|
|
|
|
|
John,
I belive RSA is what your looking for. The basic idea is use the public key to encrypt the private key to decrypt. You can get the RSA class to export the key pair without the private key.
Hope this helps
~Nick
Forever Developing
|
|
|
|
|
Look at wiki
Mainly, you are concerned about the difference between Symmetric-key cryptography and Public-key cryptography.
From your post, it seems like you need Public-key cryptography but there is a catch!
Public-key by itself cannot encrypt large messages.
Public-key crypto is usually used for setting up a shared key or digital signatures(DSA).
In shared key, one encrypts the key using a Public-key crypto(RSA,ECC,...) and sends it to the other party. The other party decrypts the key and then both parties switch to a Symmetric cipher for future transmissions. (There is also diffie-hellman key exchanges as well).
In a DSA (roughly), you encrypt the hash of your message.
It might help if you explain in more detail what you are trying to do.
|
|
|
|
|
I'm looking at encrypting a small XML file which will contain settings. Now I want the file to be unencrypted so it's readable but not the ability to encrypt a new XML file to replace it.
Cheers
--
John
|
|
|
|
|
Does the XML file need both confidentially and authentication?
Or just authentication?
|
|
|
|
|
Just authentication, do you know of a better solution to my problem?
Thanks.
--
John
|
|
|
|
|
|
Hi!
You could sign a hash value of your data (private key required for that) and verify the integrity of the hash using just the public key.
For this you only have to include the public key into your app and keep the private key safe.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I am in the proccess of writing a small membership program and all the info is being stored in an MS Access database. I've gotten stumped on coding the datagridview's "DataRelation" object because I'm having to code through three table levels.
To explain, I want to create families (Father, Mother, Children) and link them through the DataGridview.
I have a master table called "tblFamilyNames" that holds the "primary key" and anniversary date. I then have a table called tblFamilyDetails. It links the family(Father, Mother, Children) together by storing the primary key value from tblFamilyNames in a column called "intFamilyID".
In tblFamilyDetails, there is a column: "intMemberID" that points to a record in the third table: tblMembers".
My question is, how do I bind the first table: "tblFamilyDetails" with the third table: "tblMembers" so that the user can see the member's info without seeing the intermediate table: "tblFamilyDetails"?
may your code be error free
|
|
|
|
|
Hi all doing good,iam making a project on tele-presence or tele-operated robotic arm basically the progress where iam facing problem is i have compeleted the design and i hve used HS-422 servo motors and for the serial communication i have used atmega which is known as SSC-32 where it can be found at http://www.lynxmotion.com/Product.aspx?productID=395&CategoryID=52[^]
the code is in C and its complied through AVR compiler it has completed my 70% work and now the front hand remaining which i have to intreact through windows application to control arm my application has 3 features one is tht arm can be control on normal values by passing instruction and the second tht is continues movement and the third one is tht it can control by client by passing values to server now i was making on C# firstly i am not good in C# making it on Vs2005 and secondly i dont knw which component i should use like in vb6 mncom.ocx is easy but here no idea and there 2 components are given serial com in toolbox when we select windows project ..now the application iam talking about is already avaliable on java tht is open source in tht code there are 2 libararies in tht and there are classes givin in tht which is given in the link ..
http://sourceforge.net/projects/armcontrol[^]
so basically is tht i want to convert it to c# but please i need help in which componenet i should use and how i pass intruction to move motor any code snippet in c# please some one help
regards
|
|
|
|
|
VB6 is crap and works only because of OCX components that do the real work. Any COM component you may have, will work from C#, but C# is fully able to communicate with your serial ports, without any component. It can't talk to C code tho, unless it's in a Dll, then you can call it through p/invoke.
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 )
|
|
|
|
|
any procedure for tht i mean for dll and using p/invoke..
|
|
|
|
|
It's pretty straightforward, but you'd do better to look it up on MSDN or even pinvoke.net, there's articles on it here on code project, also. I think Nish has one where he refers to it as IJW ( it just works )
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 )
|
|
|
|
|
Hi,
I once looked into AVR, but ended up using a small Microchip PIC instead
(with assembly code).
And did serial comm with that, long before .NET emerged.
I will revamp that project pretty soon, this time with .NET !
if you can control the target by sending commands over a serial line,
if you know the command language (syntax and semantics),
if the number of bytes per second is reasonable (less than say 500),
if your PC has a serial port that is compatible with your target's,
if your cable is set up correctly (null modem needed?),
then you could simply write the PC-side of the app using C# and
use the SerialPort class for communication.
The SerialPort class offers port initialization, plus elementary read and
write operations (both in binary in case you need bytes, or in text characters
if your commands are "printable"). If text, be careful about text encoding,
C# uses Unicode characters (which are 16-bit), your target probably uses
8-bit ANSI (or 7-bit ASCII), so you may need an explicit Encoding.ASCII
If your command language is built from printable text, I would advice you test
your hardware set-up first, using a terminal emulator such as HyperTerminal.
If not, you need to start programming right away and would be best to try a
simple and harmless output command first, something that would make your
AVR show some reaction without being time critical or dangerous.
Then you could try to receive something; hopefully your target sends
something when it starts up, so you would catch that and show it on a Form or
Console. Your first receive attempt might use a synchronous read; final code
would require you switch to asynchronous operation, i.e. you install
a handler that gets triggered by a DataReceived event (soemwhat similar to an
Interrupt Service Routine); be careful, the event runs on a separate thread, one
that cannot reliably operate on GUI Controls, you would need Control.Invoke()
for that.
Have fun !
|
|
|
|
|
thnx for the info yes my commands are not printable iam trying to making it simple for mapping the values ..and the baud rate also its simple but any code snippet where i can get a little more idea. thnxx..
|
|
|
|
|
The CodeProject site hosts several articles on serial port and C#, such as
this one[^].
It uses printable text, which is not what you need, but it shows you how to
open a port, how the asynchronous DataReceived event works, how to use Invoke(),
etc.
You could study it, and you might even decide to modify it to make it work with your
binary command language, so you could use it to get accustomed to the
communication stuff before doing your real application.
|
|
|
|
|