|
Converters are not perfect, some are better than others and I find the online ones to be the worst.
Why? Because the best converters will compile the code first, get down to MSIL and then convert back up to whatever you want. Online converters typically don't take compiled code so they attempt to do conversions with text replacements. The one you found isn't bad, but it made up the Key part somewhere, your conversion should be:
Me.listView.Items.Add(New ListViewItem(dc.Line) With { _
.SubItems = dc.Sign _
.Tag = dc _
})
(The original code the scoping around dc.Sign is unnecessary as well as casting dc to object).
So if you change it, I'm sure you'll see SubItems come back up in Intellisense, as well as Tag. Key is not a property of ListViewItem so that's why nothing comes up in Intellisense.
|
|
|
|
|
Hi Ron,
thank you for your answer. It's funny, but during my own attempts for a working solution I had put it just that way... and of course I'm aware of what you wrote about converters.
Unfortunately there's still something wrong, the error message stays ("The property 'SubItems' is ReadOnly."). And by just opening a new Sub which contains the line
Dim mylv As ListViewItem = New ListViewItem(dc.Line) With {.s...." you can see that Intellisense doesn't show "SubItems" then.
Do you have any further hints? I was afraid that the curly brackets (".Subitems = {dc.Sign}") have to be converted in a different way – but I had no clue what C# uses them for...
|
|
|
|
|
Try SubItems.Add(dc.Line).
The collection is read-only (same in C#, so I'm not sure how they are getting away with it in the original code). You can't assign something directly to it, so it should not work in the C# code either.
In C#, the brackets are scoping characters, and in the code you posted, unnecessary for anything.
|
|
|
|
|
Ron Beyer wrote: In C#, the brackets are scoping characters, and in the code you posted, unnecessary for anything.
Ok, so I don't worry too much about the fact that I don't understand some of it
Thank you, anyway!
|
|
|
|
|
Ron Beyer wrote: In C#, the brackets are scoping characters, and in the code you posted, unnecessary for anything.
Incorrect. In this context the brackets designate a list initialiser[^]. This works because list initialisers in C# compile to repeated calls to Add, not an assignment. If that's not the case in VB then the questioner will have to call SubItems.Add directly.
|
|
|
|
|
Thanks, I never used them, I guess for good reason, they are also scoping tokens so I'm not completely incorrect but I forgot about using them that way to initialize a list.
|
|
|
|
|
List initialisers are actually really nice, particularly in writing unit tests or setting up in-memory test data.
Yes, they can be used for scoping, but only when they surround entire statements. That's rarely useful as what you'd want to use as scope regions are usually already in a block (e.g. if, foreach etc). I think case statement groups are the only place I've found that capability useful.
|
|
|
|
|
Hello my dears :
how capture object(The object can be window, control, windows,Icon shortcut menu etc)
I do not want region capture or full screen capture just object in any window in any application
I tried this code
IntPtr hWnd=WindowFromPoint(Control.MousePosition);
if (this.Handle != hWnd && hWnd != IntPtr.Zero)
{
SetOutlineRegion(hWnd);
}
SetOutlineRegion(hWnd);
this function to make border for the object(this what I need)
it works for get just window not for
The object can be window, control, windows shortcut menu etc
thanks alot
|
|
|
|
|
|
Hello:
it does not help because I need how I detect the object(like icon on desktop or menu etc...)
my problem how I know if mouse hover on object.
because I need to snapshot the object.
I hope you understand me.
|
|
|
|
|
Many objects have Mouse events - one of them is 'MouseHover'.
|
|
|
|
|
hi,
in my appli i need to read data thuogh serialport in two different times.
1) when i write data to handheld system through serialport ,that sholud send a success signal
2)To read some other data from serialport.
for the first one, i wrote the code for receiving success data, in esrialportdatareceived event.
then for 2) where can i write the code of reading. if i write in that event everytime success data is showing as output.
|
|
|
|
|
You need some method to discriminate between the two pieces of data. If the device is sending the exact same string of data every time, you can check for that and have a reasonably good idea where it came from. If not, well, then you're going to have to come up with some kind of protocol, like "framing" data, that your external devices are going to need to use to identify themselves as the source.
Or, put each device on it's own serial port.
|
|
|
|
|
Hello
Can anyone help me How grab all text from active window c#.
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Which "active window"? What environment? These and other questions help us to answer...
|
|
|
|
|
hello my friends
1-active window like (Browser,Notepad)
2-environment like windows(xp,7,..)
thanks
|
|
|
|
|
I think this may be useful: [^].
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
|
|
|
|
|
This question needs clarification.
1. by active window are you referring to the current active window of any Application ... not just your own Application ?
2. by "text from active window" are your referring to the Title of the Window a shown in the TitleBar of the Application ? Or, are you referring to actual Text in a Control in an Application Window, like a TextBox ?
The more detailed your question is ... the more you describe the context of what you are asking about ... the greater the chance you can receive useful responses.
"What Turing gave us for the first time (and without Turing you just couldn't do any of this) is he gave us a way of thinking about and taking seriously and thinking in a disciplined way about phenomena that have, as I like to say, trillions of moving parts.
Until the late 20th century, nobody knew how to take seriously a machine with a trillion moving parts. It's just mind-boggling." Daniel C. Dennett
modified 14-Dec-13 5:06am.
|
|
|
|
|
yes this what I Need
1.active window are you referring to the current active window of any Application.
2. actual Text in a Control in any Application Window like all text in this page or any program(just text from it)
thanks
|
|
|
|
|
Hi everyone;
i am using emgu cv 2.4.9 beta. I have installed this but i have a problem.
When i create a project and adding reference dlls and others dll. I have cv.invoke error. But when i go project settings and change my output directory to emgu\bin\ everything is ok. What must i do to solve this problem. Does somebody solve this ?
I have solved my problem but i took another error.
badimageformatexception
thanks..
modified 14-Dec-13 7:15am.
|
|
|
|
|
Hello
how I can create power point file from c# and add image to it just empty ppt and contains image
thanks in advance.
|
|
|
|
|
|
|
script code for mobile wireless sensor networks in c# please>>i can buy it >>if ..email: nas4yemen@gmail.com
|
|
|
|
|
For me that doesn't make much sense.
are you after something that scans to see what wifi signals are in the area?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|