|
Listbox class has Items property which gets the items of the listbox. You can iterate over them and search for the string you are interested in.
|
|
|
|
|
ListBox.FindString() and ListBox.FindStringExact()
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello All,
I'd be grateful if someone could give me some pointers or recommend some good links on writing addins for Messenger Live. I'm a bit new to C# so I'm treating this as a mini-project to better my understanding. Essentially what I'd like to do is add a spell check facility to Messenger using Word's Spelling API's.
I've written a small addin for Messenger using some example code and found another good example of calling MS Words Spell checker.
The Messenger example code I'm looking for is how to add a button to the conversation window.
Also are there any security limitation on what I'm trying to do as I noted on MSDN that add-ins run in a security sand-box, using the "Internet Zone" permissions, they have very limited permissions about reading/writing files, modifying the system registry and so on. To make sure an add-in runs in a fully trusted environment, you should install your assembly in the GAC.
Does anyone have any suggestions?
Thanks in advance.
|
|
|
|
|
I'd bet that using the Word APIs to spell check won't be possibly in Messenger's sandbox.
There are plenty of other free, portable spell checkers/dictionaries you could use though.
|
|
|
|
|
Hello,
I have a datagridview that is updating its DataSource every few seconds. I am maintaining the same DataTable and merging any new data that comes in. I am having an issue with the behavior when adding new rows. Say my grid has 100 rows and the user is scrolled down to view row 50. At that time, the grid gets 100 more rows and adds them. I need to keep the user at their scroll position or keep them in view of their selected row. Cheers
|
|
|
|
|
Hi Everyone,
i need the C# code for exporting data in excel sheet to XML file.
Kindly help me out.
Thanks,
Srikanth
|
|
|
|
|
You can accomplish this using Excel object library and few lines of code
|
|
|
|
|
ok please let me know the code.
Thanks,
Srikanth
|
|
|
|
|
Excel object library exposes methods for opening excel files and saving them to the format you specify. If you explore Excel object library using object browser you will be able to identify those methods. No one is going to write instead of you.
|
|
|
|
|
Hi,
I am trying to print a file. The file can be word, ppt, xls etc etc.
Instead using the COM objects i want to print the required file, so i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file!
Is there any other way? To print the required file
The printer setting are set in a way that the file after print would be saved in a default location!
gauthee
|
|
|
|
|
In order to print directly to a printer, you have to send native codes in the language of the printer. This is all done for you in the background via the windows printer drivers. So, unless you have specific knowledge of each printer your application is going to use, use the windows print drivers.
If you try to send a word file directly to the printer, nothing will happen.
Hogan
|
|
|
|
|
gauthee wrote: i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file!
And in each and every case, you'll be printing pages and pages of complete garbage. You can NOT just send what the application saved to disk to the printer and expect a nice image to appear on the paper. The printer doesn't know anything about any applications file format and applications don't save their files as a nice printed image on disk.
|
|
|
|
|
Hi
I m sending a large file using streaming.I want to read the no. of bytes recieved in my recieved buffer. As buff.length give the size of buffer, it doesn't specify the no. of bytes read. SO plz tell me any method for it ASAP.
Regards.
Shanzay
|
|
|
|
|
Maybe:
FileStream myFS = new FileStream(filename, FileMode.Open, FileAccess.Read); BinaryReader myBR = new BinaryReader(myFS);
byte[] outData = new byte[myBR.BaseStream.Length];
for (int x = 0; x == myBR.BaseStream.Length; x++)
outData[x] = myBR.ReadByte();
gauthee
|
|
|
|
|
Hi,
(1) Is there any reason why I have to click three times on the dropdown button of a DataGridViewComboBox before the dropdown list actually gets displayed?Is it the Control property that an user needs to click thrice.
(2) We want that the items list should be made visible by clicking it once. And then by next click the item should be selected. Please let us know how to achieve it.
Thanks & Regards,
Rudra
|
|
|
|
|
I have file I want to transfer it from pc to another via modem the problem is I want to make the procedure on one button click. one in the sender side to send the file and another on the receiver side to receive the file.
I think it would be possible to do it depending on hyper terminal but i couldn't find way to run hyper and work on it on c# project ?
if any body can help on this way or another ?
best regards
sam
|
|
|
|
|
Hi
I have a problem with load WSE 3.0 to ma project in Visual Studio 2005 (C#).
I am doing liki in this site: http://dotnetslackers.com/articles/aspnet/GettingStartedCreatingWSEEnabledWebService.aspx
and
http://www.15seconds.com/issue/040603.htm
but when I right click on the asp project I don't have WSE Settings..
" Step 1
Right click on the web service project http://localhost/DocumentLibraryService and select WSE Settings 3.0… from the context menu.
"
I installed WSE3.0 with opiton for Visual Studio Developer and I have it in the start menu, but I don't have in the my project. I must set several option that add to the web.config but how I do it ?
Best regards
difit
I
|
|
|
|
|
How do I make textbox (or label) to have a value, who
is increment for 1, every time when I put some
data in database?
For exaplme, textbox had a value=1!
When I press button, ex: Insert data,
the data are inserted in database, and
textbox then, should have a value 2!
Like a sequence number, I need for
inserting data in database, but I don't user
to enter this, number, instead, the number to
increment it self, when I press button, ex: Insert data,
and, value of that textbox to go in database...
Thank you!
kpp
|
|
|
|
|
KppsK wrote: How do I make textbox (or label) to have a value, who
is increment for 1, every time when I put some
data in database?
For exaplme, textbox had a value=1!
When I press button, ex: Insert data,
the data are inserted in database, and
textbox then, should have a value 2!
Like a sequence number, I need for
inserting data in database, but I don't user
to enter this, number, instead, the number to
increment it self, when I press button, ex: Insert data,
and, value of that textbox to go in database...
You have a counter somewhere. In your button handler for the insert you increment the counter and update the Text property of the TextBox.
|
|
|
|
|
just keep your textbox's enabled property = false...
and in the click function of the button
write this
private void button1_Click(object sender, EventArgs e)
{
int i = int.Parse(textBox1.Text) + 1;
textBox1.Text = i.ToString();
}
Kuldeep
|
|
|
|
|
Well - first of all, the database must support an autoincrement. Then, you need to get this value back. If it's SQL Server, then you are in luck because you can use the Scope_Identity in the same command to retrieve the value just inserted. Ideally, you would do this in a stored procedure. For instance:
CREATE PROCEDURE [dbo].[SaveData]
@ID INT OUT,
@Name NVARCHAR(50)
AS
SET NOCOUNT ON
INSERT INTO MyTable (Name) VALUES (@Name)
SET @ID = Scope_Identity() To retrieve the information, you would use a SQL Command and add the @ID and @Name parameters yourself. The OutputDirection of @ID would be InputOutput, which allows you to retrieve the incremented value from @ID.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
From a windows application form I need to print a ticket from a special ticket printer. that ticket includes a 2D barcode which is a string of all the information about a customer. I need to encrypt it and get as a byte array so I use Cryptoservices and done that. to concatenate that data with other data I've done something like this
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
string str = System.Text.Encoding.ASCII.GetString(b);
So printing part is working fine. But when I scan the barcode and try to get it back to byte array like this,
byte[] b = System.Text.Encoding.ASCII.GetBytes(data);
Then my array size gets smaller and when I try to decrypt it it throws an error saying that invalid length of string.
can anybody help me.
|
|
|
|
|
You can't use ASCII encoding to get the bytes as a string. It only support seven bit character codes, which means that any byte that is between 128 and 255 is replaced by a question mark.
Actually, you shouldn't use any text encoding at all to turn arbitrary bytes into text. Most encodings does't have a character for every possible byte value. Text encodings are used to turn text into bytes and back, not the other way around.
You have to encode the bytes in a different way. You can for example use base64 encoding:
string str = Convert.ToBase64String(b);<br />
<br />
byte[] b = Convert.FromBase64String(str);
---
single minded; short sighted; long gone;
|
|
|
|
|
when I use base64 its working fine. But i want to optimise the space taken by the barcode. I tried hex conversion and that also works fine. and then the size of the barcode is smaller. I want to make it much smaller.
|
|
|
|
|
Base64 puts 6 bits of data in each character, which only gives an overhead of 33%. That's the most compact way that you can easily represent binary data as text.
Hexadeximal representation only puts 4 bits of data in each character, giving an overhead of 50%.
Even if you find some complicated conversion that can squeeze almost 8 bits of data in each character, that is only about 30% better than base64. If you want to make the string substantially shorter, look at what the data represents and see if you can remove any unused parts of it.
---
single minded; short sighted; long gone;
|
|
|
|