|
in this case just use:
label1.Text = combobox.SelectedText;
|
|
|
|
|
thanx for your time, but this is how it suppose to be.
label103.Text = IncomeCombo.SelectedItem.ToString();
Chindiwo
Programmer
-----
|
|
|
|
|
That's simple: label1.Text is of type string, combobox.SelectedItem is of type object, that's what the error most likely tells you.
Reading (and understanding!) the errors you get is the key to successful programming.
Convert the object to string by using ToString() for example.
Try:
if (combobox.SelectedItem != null)
label1.Text = combobox.SelectedItem.ToString(); Regards,
mav
|
|
|
|
|
thanx a lot man! It works!
Chindiwo
Programmer
-----
|
|
|
|
|
Hello,
I want to lock my data grid mouse events during row based operations.For example when I make an update operations on a row then I should not pass another row by clicking mouse.
How can I do this.Any idea?
Thanks
|
|
|
|
|
normally it should be enough to disable the control.
dataGrid1.Enabled=false;
this way no input reaches the control anymore
|
|
|
|
|
Hello,
I want to lock my data grid mouse events during row based operations.For example when I make an update operations on a row then I should not pass another row by clicking mouse.
How can I do this.Any idea?
Thanks
|
|
|
|
|
i have found the code here (http://www.codeproject.com/dotnet/CSharpWhiteboard.asp) ,but it only can be used by two users . unfortunately, i need one which can support many users (i know that it need a server ,and need to use SOCKET) .
how to finish it ??? need to help !
thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
can u send me some useful things about it ?
my email------------- saxon_100@hotmail.com
help!!!help!!!
|
|
|
|
|
I feel compelled to explain that your method for asking for help probably isn't the most effective.
If I were to change the code I would probably change it to use a Message Oriented architecture.
-
Drew
|
|
|
|
|
I have several projects that make up part of a solution. What I would like to do is share two froms across two seperate projects.
Is this possible and how?
Thanks in advance.
Stephen
|
|
|
|
|
How about putting that form in a separate assembly and accessing it from your two projects?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
OK. Sounds good but I have not done this before and i am new at C#.
Have you a link to a sample or something?
Thanks.
|
|
|
|
|
It's fairly simple.
1. Add a new "Class Library" project in your solution.
2. Drag and drop the form that is to be shared, into the new project.
3. Add references to the new project from the projects that need to use the form (Right click on the project in Solution Explorer, click Add References and go to the Projects tab).
That should do the trick. Just make sure the shared form is under the same namespace, otherwise, you need to add a "using" directive.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
i want to generate xml given below using serialization. i have made the class and successfully generated the xml without the "soap:" i am not using any soap attributes. when i mention in [XmlElementAttribute("soap:Header")]
i get some junk char instead of ":" can anyone help me how excatly it should be done..... thanx
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
<soap:Header>
<MyCustomSoapHeader soap:mustUnderstand="1" xmlns="http://www.contoso.com">
<custom>Keith</custom>
</MyCustomSoapHeader>
</soap:Header>
<soap:Body>
<MyUnknownHeaders xmlns="http://www.contoso.com" />
</soap:Body>
</soap:Envelope>
|
|
|
|
|
Hello,
I have a C++ dll that I just created and im having trouble converting the data inside a BYTE * to a C# version of byte[].
On my C# App I DllImported the dll, the return type was set to an IntPtr (the return type of the C++ dll is BYTE *)
I then took the IntPtr and did a Marshal.Copy the IntPtr into a byte[], then put the byte[] inside a MemoryStream.
The output should have been an image (bitmap). but when trying to save to file it gives an error of not valid type.
My question is, on the C++ dll, what type is BYTE *? on my C# side should I go int, Uint32, IntPtr??
Any help would be greatly appreciated.
Steve
|
|
|
|
|
Did I create a tough question?
Does anyone know what to Marshal the BYTE * on the C# side of above?
|
|
|
|
|
Hi I am developing an asp.net web application using c# and having trouble trying to display integer values, that I have taken from the database, correctly on my webform textboxes. The values are consistently displayed with four 0’s after the decimal point and I am just wondering if anyone knows how to prevent this from happening. Thanks in advance.
Tadhg88
|
|
|
|
|
Either the ToString method on your numbers will take a format specifier, or a String.Format can take a format specifier to state how many digits you want after the decimal point.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hey!
I have built a class that inherit from the Stream class, but i am not realy using any of the Streams members, can i still call my class a Stream class?
My stream class need one stream from the serial port, and one stream from the units within the program.
To get this i add two ArrayLists(BuffertFromPort and BuffertFromUnit) to my Stream class..
My ide of this stream class is to let every unit(that needs the stream) get access to this stream object(as with regular stream objects),
Unit Reading part
the stream object stores the units name and the reader position on the BuffertFromPort array.
The units use a event on the stream to know when data is added on the BuffertFromPort array.
When this event is fired the units is providing there unit name to the stream object, the stream object looks how much data the unit is behind and returns this data to the unit. Is also moves the reader position of the unit.
The stream is using FIFO(First in first out), this means that if all unit reader positions is past a particular elemtn in the array, then it will remove all data before this poition.
Unit writing part
Only one unit can write to the serial port at once, so the unit need to get promission by the stream, if there already is another writing unit then the other unit will have to wait until the writing unit leves the premission free.
also this will be using events to let the serial port know when data is sent from a unit inside the program.
Incoming data from serial port
When data comes on the serial port i use ReadExisting witch return a string, this string is parse to byt[] then it is added to the Arraylist in the my stream object. When i unit is reading it returns the byt[] on a particular element and then the unit is parsing it to string(or what ever) there is also a function to let my stream class handle the parsing from byt[] to string.
THE REAL QUESTION
1. Can i call my class a stream class despite i dont use any of the Strem members?
2. Am i doing this the wrong way?
3. I know that you can connect streams to particular controls, is there any way i can do this?
Best Regards
snowman
|
|
|
|
|
Can someone please help me wih parseing a simple text file using C#? What I want to do is parse the text file and then put the chars parsed into a database. How would I do this?! Please help!
-Geiste
YOU! Out of the gene pool!
|
|
|
|
|
It depends entirely on what you need to parse, and which bit you're stuck with. Do you know how to read in a text file ? Do you know anything about regular expressions ? Is your input text complex enough to demand the use of regex ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
To read a text file:
using System.IO;<br />
<br />
TextReader txtRdr = new StreamReader("date.txt");<br />
string line = tr.ReadLine();<br />
txtRdr.Close();
To enter the chars into a DB, it depends on the DB. And what exactly do u mean by "putting the chars parsed into a database"? Each row of a table would contain one character?
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank you for your help thus far. Polis:
Polis Pilavas wrote:
To enter the chars into a DB, it depends on the DB. And what exactly do u mean by "putting the chars parsed into a database"? Each row of a table would contain one character?
I am entering the information into rows in a MS SQL DB. Each text file has 255 chars. Each value is a fixed length from eachother. (0,5) is one value. 6,12, is another vlaue. Etc, etc. There is no pattern. I assume I will have to use an array to get all the information to store?
Each value I select will also have a row. I dont know if I am giving enough information. So I will put this as simple and direct as possible.
Think of a spread sheet, Each coloum has a title to it. Below each title is a value (1-5). Each row is a diffrent time the information is assigned (I will need a ID for this). So each time I parse this text file I will be taking the information from the text file placing it in it's row and then pulling the now structured information into my application... Does that make sense? I am trying to give as much information as possible to help
-Paul
|
|
|
|
|
Hmm.... I am not sure I understand what you are trying to tell me Paul. Let's see:
geiste wrote:
am entering the information into rows in a MS SQL DB
By an MS SQL DB you mean SQL Server? MS Access? Because each database type has a different ADO.NET connection type. For instance, MS Access needs an OleDbConnection. For general info on how to access a database, and loop through a table's records and read their values have a look here[^].
For different database types and information on how to access them, a simple Google search for something like "C# ADO.NET" or "Ms Access C# ADO.NET" would return thousands of hits, so take your pick
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank ya, yes I am using SQL Server 2000. I will try your hints, anyother advice?
-Paul
|
|
|
|