|
signimage wrote: In form i have different object (like picturebox),i want to acces these object from another class for example class1
The default access/visibility level of the form's objects is private . To use your form's objects in another class, you have to change its access level from private to public (or what is more appropriate) through its Modifiers property.
________________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
you should declare object public in partial class and formName.objectName acces object .
|
|
|
|
|
hi
i want to use TableAdapter in VC# 2005,how to use ??
does anybody know or have an article for this topic ?
thanks
|
|
|
|
|
The table adapter is used to get data from database and put it inside a table with the help of the data set. tell us what u specifically need from this object and i may provide u with some help.
best regards
jamil abou khalil
|
|
|
|
|
Hi,
How can I convert char[] to byte[] without loss of data?
Regards,
Hemant.
|
|
|
|
|
How can I convert char[] to byte[] without loss of data?
typecast it
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
char[] c = new char[2] { 'a', 'b' };
byte[] b = System.Text.Encoding.ASCII.GetBytes(c);
|
|
|
|
|
That depends on how you want to convert it.
The char data type is a 16 bit unicode character. Unless you have restricted the characters to use only ASCII characters, each character can not be converted to a byte.
If you want to convert the string to it's encoded format, you can use the GetBytes method of the encoding you want to use. Example:
byte[] data = Encoding.UTF8.GetBytes(theChars);
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
Is any body provide me information about IpAddress control in C#. i couldn't find any thing
|
|
|
|
|
IPAddress Class[^]
If you're looking for an UI control that lets you specify an IP address there isn't one in the .NET Framework class library AFAIK. But there should be some custom controls for it out in the internet. I think there even was an article here on CP presenting such a control.
"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
|
|
|
|
|
In my project two forms(form1 and form2)
when from form1 i try to Access any object of from2 then it give me error that object reference not set to an instance of object,
me using following way
in form1 i create the obg of from2 as
from2 f=new fomr2();
Bitmap b=(Bitmap)f.pictureBox1.Image;
if(b.GetPixel(100,100)==-1)
{//code}
it give the abovemention error in if statement when i try to accec the pixels of that object.
What should i do?????????
|
|
|
|
|
Just by instantiating the form does not necessarily mean that the picture box will have anything in it. Thefore the error is correct.
Where does the picture box get its image? Once you have the answer to that then you know what else you need to instantiate in order to get your code to work.
|
|
|
|
|
PictureBox take its image from file and i m sure that pictureBox has its image,this is not empty pictureBox but still it give thte above mentioned error
|
|
|
|
|
signimage wrote: PictureBox take its image from file and i m sure that pictureBox has its image,this is not empty pictureBox but still it give thte above mentioned error
Obviously, it is an empty picture box at the time you are running your code otherwise you would not be getting the error.
Since you don't seem to be doing anything else with the form (at least from the code you provided) then I would suggest that you probably don't need the form anyway. Perhaps you just need to instantiate a Bitmap with the relevant file and use that.
|
|
|
|
|
is there any way to access the from object from another class,usually i create the obj of form then using that obj we access the obj from form then why it give me the null reference erroe, and im sur that obj has obj referenc but it cannot send this reference to other class,(why)
|
|
|
|
|
i face the same problem when ever i try to acces any object of form from any other calss (within same project)
how to acces the form object (like picture) from any other calss
i use the form obj to acces the formobjfrom other class but it give reference inmstance error
|
|
|
|
|
That is because it is obviously not instantiated properly. A form is a class designed to store stuff that is displayed on the screen (within that form). If you are not going to display it on the screen then your design is screwed up and you should reconsider what you are doing.
|
|
|
|
|
Colin Angus Mackay wrote: That is because it is obviously not instantiated properly
how to instantiat object properly?
|
|
|
|
|
SomeClass instance = new SomeClass();
or variations on that theme. See the class documentation in MSDN for details. Some objects use static Create methods instead.
|
|
|
|
|
Hi...
In my application i am receiveing some text on serialPort but i dont want to display all the received text.
e.g. My received text is " Current Time : 08 NOV 2006"
so i just want to display... "08 NOV 2006" in a textbox with my application.
In serialport communiation i have to use SerialPort.ReadExisting(); & because of this i am getting text(" Current Time : 08 NOV 2006") in DataReceived Event as " Cu" , "rrent", "Tim", "e : 08"... I want to say i'm receiving my text in parts.
My applcation should remove " Current Time : " & it should display only time in a textbox.
Can anybody give me any suggestions to implement this in my application...
Thanks in adavance,
Vinay
|
|
|
|
|
Hi,
youc an have the result in a string variable and then replace 'Current Time :' with empty string.
like if strTime is the string containinf "Current Time : 08 NOV 2006" then
<br />
strTime = strTime.Replace("Current Time :", "");<br />
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
store the incoming text in a string and then you can use the split method of string to split it by ':'. this way you will be able to get two strings of that time. So you can easily display the time and not the text.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Thanks...
can you help me for one more thing...
If i am waiting for some text on my SerialPort & after receiveing that text only i have to transmit some text then how i can do that.
e.g. say i've to set the date. & am waiting for text "Set Date : "... & after receiveing this on comport i have to transmit "08 NOV 2006"
Thanks for your replies,
Vinay
|
|
|
|
|
Dear friends,
I have one simple user control in my web based application with five buttons.
When i used it on the webforms of my application as a user control it does not give me the events for Save, Delete, Add etc.
Please can some one help me out in this matter how to raise event on the webform with the user control. Your quick response will be highly appreciated.
Thanks
Murtuza
|
|
|
|
|
There are no events for save/delete/add, unless you're using a grid control that offers them.
You probably need to define your problem more. If your control needs to pass events to the main form, you need to hook them up in the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|