|
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
|
|
|
|
|
Hi
i am trying to check for the existance of a directory using C# but don't know exact format to use it.
My.Computer.FileSystem.DirectoryExists("C:\\directoryname")
can someone help me by guiding me to the exact way of knowing the existance of directory.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
hi!
try this
DirectoryInfo dr1 = new DirectoryInfo("c:\\dirname");
if (dr1.Exists)
{
MessageBox.Show("Directory Exists")
}
abhinav
|
|
|
|
|
saqib82 wrote: My.Computer.FileSystem.DirectoryExists("C:\\directoryname")
This is VB, VB has nasty shortcuts ( nasty because they don't flow to C# ).
if (System.IO.Directory.Exists(@"c:\Directoryname"))
{
// Whatever
}
The @ allows you to type \ without having to do \\
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks christian, i was trying to do something like we do in vb. But finally i did the same thing that you have suggested. Sorry you are late, but thanks again for your help.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
I have a problem in textbox i want when somebody enter a character in the textbox the textbox show another char (Unicode Char) for example if entered 'd' the textbox show 'h'(or Unicode char)
is there any Solution?
With Thanks
MHF
|
|
|
|
|
you can do so using the event of KeyUp. Do whatever you want to do in that event and as the user will write some character, that character will immediately be converted to your desired character
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Sorry but i can't understand exactly please give me a sample
With regards
MHf
|
|
|
|
|
I guess you are creating a textbox for custom non english language. Follow the following steps which will help you out.
<br />
- Derive a class from TextBox.<br />
- Override OnKeyPress protected function (This is called before character is displayed on the screen).<br />
- Read e.KeyChar.<br />
- And finally replace e.KeyChar with new character.<br />
Thats it...
|
|
|
|
|
But e.KeyChar is readonly ????
MHF
|
|
|
|