vb.net

Constructing an object without assigning it in Visual Basic.NET

廉价感情. 提交于 2021-02-16 20:06:06
问题 I've used VB.net for several years now, but keep coming across little quirks that I don't know how to work around. Curiosity finally got the best of me, so I ask now: is there a way to create an object without assigning it? For example, say I have an Engine class, that I want to instantiate and have it immediately do whatever it needs to do. If there's nothing I need to do with Engine after creating it, I have, till now, done something like: dim myEngine as new Engine() Is there a way to

Where the 'Type' of a reference value is stored in memory?

左心房为你撑大大i 提交于 2021-02-16 19:50:21
问题 As the reference values are stored in the heap as a data; where do the type information of any reference value is stored? If there are a couple of instances of class Artist; when they are stored in the heap how the .Net tags those memory blocks as type of Artist? thanks! 回答1: void M() { Artist a = new Artist(); } When the method is called, a new stack frame is expanded, CLR has some preparation code before the first statement of the method is executed, like a prolegomenon . During this period

LINQ Select Syntax VB.NET

一曲冷凌霜 提交于 2021-02-16 15:59:34
问题 I have a list of Tuples I am trying to run a Select and Where query on to return a list of Objects from the Tuple.Item5 parameter. In my where clause I am looking to match Tuple.Item4 to a local variable. I'm not sure what the VB.NET syntax is for the Select portion, I only know the c# syntax. Essentially I am trying to select Tuple.Item5 from my list of tuples where Tuple.Item4 = sCurID. I'm unsure as to what should go in the Select section although in c# I believe it would be Select(t => t

Placeholder in TextBox in Window Forms using VB.NET [duplicate]

强颜欢笑 提交于 2021-02-16 09:16:03
问题 This question already has answers here : Watermark TextBox in WinForms (10 answers) Closed 2 years ago . I'm working on a Windows Forms application in VB.NET and I am currently making a login screen using labels and TextBoxes. What I need is the Placeholder in TextBox controls you can see below ↓ (not mine obviously) Is there any property in TextBox that allows me to set the default placeholder (placeholder, watermark, hint, tip) to what I want it to be? If there is not any, how can i solve

Placeholder in TextBox in Window Forms using VB.NET [duplicate]

牧云@^-^@ 提交于 2021-02-16 09:15:42
问题 This question already has answers here : Watermark TextBox in WinForms (10 answers) Closed 2 years ago . I'm working on a Windows Forms application in VB.NET and I am currently making a login screen using labels and TextBoxes. What I need is the Placeholder in TextBox controls you can see below ↓ (not mine obviously) Is there any property in TextBox that allows me to set the default placeholder (placeholder, watermark, hint, tip) to what I want it to be? If there is not any, how can i solve

Placeholder in TextBox in Window Forms using VB.NET [duplicate]

两盒软妹~` 提交于 2021-02-16 09:13:14
问题 This question already has answers here : Watermark TextBox in WinForms (10 answers) Closed 2 years ago . I'm working on a Windows Forms application in VB.NET and I am currently making a login screen using labels and TextBoxes. What I need is the Placeholder in TextBox controls you can see below ↓ (not mine obviously) Is there any property in TextBox that allows me to set the default placeholder (placeholder, watermark, hint, tip) to what I want it to be? If there is not any, how can i solve

Regex to match everything except a list of characters

我与影子孤独终老i 提交于 2021-02-16 08:59:09
问题 I want to match a line containing everything except the specified characters [I|V|X|M|C|D|L] . new Regex(@"^(.*) is (?![I|V|X|M|C|D|L].*)$") should match everything except the characters mentioned in the OR list. Should match - name is a Should not match - edition is I 回答1: Try this pattern: ^[^IVXMCDL]*$ This will match the start of the string, followed by zero or more characters other than those specified in the character class, followed by the end of the string. In other words, it will not

How to Invoke MessageBox on background thread in VB.NET?

拜拜、爱过 提交于 2021-02-11 18:15:40
问题 How do I call Invoke to run MessageBox.Show on my background thread please? When I display a MessageBox on my single background thread, it usually displays behind the main form, so to make the program usable I need to display it in front of the main form. My current code is MessageBox.Show(myMessageText, myTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) without owner. This code is not called from the form itself. but from a helper class I have built outside it. I want to add an owner

How to set cursor position at end of text while open notepad (log file)?

不打扰是莪最后的温柔 提交于 2021-02-11 17:37:45
问题 In my application, i add/append exception log in notepad and now logs are too big so to make it user friendly i decide to set cursor position at end of text of log file so when user click on "View Log" button from application s/he can show most recent log. So to avoid scrolling i want to set cursor at last. Currently i am simply using : Process.Start("notepad.exe",Path) to open log file. 回答1: Once Notepad is started, find its window. You can use user32.dll.FindWindow. Use SendMessage to send

Searching entire computer for specified file

女生的网名这么多〃 提交于 2021-02-11 17:22:28
问题 Is there a way to search the entire computer and get the full file path of specified file, given a filename to match against? If you enter for example "file.dat" in textbox it show you full file path if it exist? 回答1: Look into the Directory class in System.IO . Whichever solution you use, avoid using GetFiles() instead use EnumerateFiles() since EnumerateFiles() is recommended for large arrays. (In your case the entire C drive) As per the MSDN documentation: Enumerable collections provide