|
I want to show the text from a ListView subitem in a ToolTip when the user puts the mouse over a row.
I have:
void diaryListView_MouseMove(object sender, MouseEventArgs e)
{
ListViewHitTestInfo lvhti;
lvhti = diaryListView.HitTest(e.X, e.Y);
if (lvhti.Item != null)
{
ListViewItem item = diaryListView.GetItemAt(e.X, e.Y);
string notesText = item.SubItems["Notes"].Text;
}
}
but I have the error "Object reference not set to an instance of an object" for the line: string notesText = item.SubItems["Notes"].Text;
What should I have done to correct this please?
|
|
|
|
|
Firstly, why are you doing ListViewItem item = diaryListView.GetItemAt(e.X, e.Y); ? Can't you just use lvhti.Item ?
The error means that an object you are trying to use is null.
Item could possible by null, (although I suspect that is unlikely because you did a hit test first, and checked that for null).
More likely is that the item does not have a sub item called notes.
if (lvhti.Item != null)
{
if (lvhti.Item.SubItems.ContainsKey("Notes"))
{
String notesText = notesItem = lvhti.Item.SubItems["Notes"].Text;
}
} You should check that the subitem you are looking for exists first.
Simon
|
|
|
|
|
Many thanks for your reply Simon. I've referenced the SubItem by index, rather than name, and it works fine. Although I'm not sure why referencing it by its name does not work.
|
|
|
|
|
Check that you have got the name exactly correct including the correct case. Check you are setting the key correctly when you create the subitem.
(If it's still not working, post the code where you create the items and sub items)
Simon
|
|
|
|
|
Hi,
I've created a borderless form which is custom located at point(0,0) (the top of the desktop).
the form size is; height: 26px, width = screen width.
my case is when I open another application (i.e. msWord) the top of the msWord window (Title, Grabbing aria, close, min, max buttons) is hidden behind my topmost form.
How can I setup my form to act like the taskbar; which will not allow the new application window to load behind the bar?
tnx
|
|
|
|
|
leeoze wrote: How can I setup my form to act like the taskbar; which will not allow the new application window to load behind the bar?
You need to register your application as an AppBar for this to happen. See this[^] MSDN article and this[^] CP article.
/ravi
|
|
|
|
|
hi,
I have made an application in which i am recording phone call using voice modem in my personal computer,now i want to make answering machine like in call center ,ex.. press 1 for change language. press 2 for recharge like that any idea???
Thank's
jugal
|
|
|
|
|
Modern telephones use Dual-tone multi-frequency (DTMF)[^] signals to represent the numbers.
You need to play your message "Press 1 for this, Press 2 for that" and then listen to the incoming signal. You need to processes the signal and determine the low frequency portion and the high frequency portion. You can then determine the number (Keypad[^])
(You should also make sure you handle the case that the user doesn't have a DTMF telephone. There are other methods like pulse dialling, which are rarely used any more, but probably still exist. Just have a default selection if no tones are detected)
Simon
|
|
|
|
|
I want to get the row index when I hover a datagrid.
I use the mousehover event but can't seem to get the row index since I want to get the rowindex even if the actual row has not been clicked.
Any help appreciated.
|
|
|
|
|
Im using a tool by sysinternals that shows me whether a file has a signature and the date it was signed. However, I need the api for C#, so that i can get the same results.
Atm I use cmd sigcheck send the results it to a stream and parse the results, but if i have 1000s of files I need to process.start cmd 1000s of times.
Any help is appreciated.
|
|
|
|
|
Sigcheck can check several files located in the same directory. Here is an example: Sigcheck v1.54
|
|
|
|
|
Yes, I use sigcheck quite extensively, and can get all values for any file.
However my question is, I don't want to do it from dos, but use some class helper in c# that will do it for me.
So that when i pass the ProceesModule / FullName it will return me those same values that sigcheck return in a dos command.
|
|
|
|
|
greetings all
i want to append the values from a sql query to a datagrid and i'm using the following code.
{
string sqlquery;
sqlquery = "select " + txt_comkey_tbl1 + " from " + Table1 + " where " + txt_comkey_tbl1 + " not in (select " + txt_comkey_tbl2 + " from " + Table2 + ")";
dbCmd = new OleDbCommand();
dbCmd.Connection = dbConn;
dbCmd.CommandText = sqlquery;
dbCmd.CommandType = CommandType.Text;
dbtable = new DataTable(sqlquery);
dgTblDiff.DataSource = dbtable;
}
the code compiles successfully but the grid isn't populated. have i missed something??
please help
|
|
|
|
|
|
I have a third party components that gives me update in form of events upon subscribing for it. Now problem is upon subscribing for lots of such items I may end up receiving lots and lots of event updates at the same time, and I have to handle all of these ...
Kindly suggest some ways to do the same.
Thanks in advance
|
|
|
|
|
Your question is not clear. Could you explain it more?
|
|
|
|
|
I have a publish subscribe system, that upon subscribing to it, sends update in form of an event... when I subscribe for tooo many items ... I end up generating lots and lots of events at the client end. Now how to handle such a situation...
Any Suggestion ...
|
|
|
|
|
Hi everyone,
I have a RTB, it's ScrollBars property is None. So if user types too many characters and characters rich the end of my RTB, he/she can't see some characters. How can I get the Maximum number of characters which my users can see?
Hope you understand
Thank you.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
It will depend on the size of your RichTextBox and whether you are using a fixed length font or not, what was the reason for removing the scrollbar?
|
|
|
|
|
Thank you for your reply.
smyers wrote: the size of your RichTextBox
It's constant.
smyers wrote: whether you are using a fixed length font or not
Actually not.
smyers wrote: what was the reason for removing the scrollbar?
Actually I want to create a MSWord-like application, when user riches the end of a RTB, I'll create a new RTB and user can type his/her remaining characters in it.
If you (or anybody) have another idea, I'll be glad to hear it.
Thank you again
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
Why are you creating a new RTB, is it for a new page?
|
|
|
|
|
smyers wrote: is it for a new page?
Yes, definitely.
Creating a new page instead of scrolling down, it's what I want to do.
You said it depends on RTB and font size. If your RTB's Height was 100pxs (WordWrap is true) and font size was 8 and font-family was Tahoma (is font-family makes any difference?) how could you do that?
Thank you very much.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
I don't think this is the best way to do it, you will only be able to use monospace fonts and then you would have to physically count how many characters would fit in the RTB before they reach the end.
|
|
|
|
|
hi
i want to append string to third last line in a text file.
appending string to last line is running successfully.
please help.
Thanks in advance
|
|
|
|
|
I think you have to read the whole file, append the string at required location and then write the whole data again.
*jaans
|
|
|
|