vb.net

Visual basic. Change default startup form in code, depending on value of variable

不想你离开。 提交于 2021-02-05 08:17:26
问题 I have been working on a Visual Basic project in Visual Studio and have encountered a problem. I understand that the Startup form property in the Application page of the Project Designer can be changed to a default form, however what I require is a way to do this through code in ApplicationEvents.vb depending on the value of a variable within application settings. The goal is that if a user completes a form then a value is assigned to a variable, e.g. variable username = "xxx". If this value

Is there a best practice for parsing all information contained within one parent XML node?

点点圈 提交于 2021-02-05 07:49:46
问题 I'm writing a VB.NET application to parse a large XML file which is a Japanese dictionary. I'm completely new to XML parsing and don't really know what I'm doing. The whole dictionary fits between two XML tags <jmdict> and </jmdict> . The next level is the <entry> , which contains all information for the 1 million entries, including the form, pronunciation, meaning of the word and so on. A typical entry might look like this: <entry> <ent_seq>1486440</ent_seq> <k_ele> <keb>美術</keb> <ke_pri

What's the correct way to convert this event handler registration from C# to VB.net?

吃可爱长大的小学妹 提交于 2021-02-05 06:57:05
问题 I'm trying to port some code over from C# to VB.net and I am having trouble with a simple event handler. C#: hook.KeyPressed += new EventHandler<KeyPressedEventArgs>(hook_KeyPressed); I've written it as such in VB.net: AddHandler hook.KeyPressed, AddressOf hook_KeyPressed But my conversion is missing any reference to KeyPressedEventArgs in the C# code and i'm not sure if I'm doing this right. Any help would be appreciated. 回答1: Remember, that an event is a delegate. To subscribe to the event,

Gridview Hyperlinkfield using DataNavigateUrlFormatString with Ampersand

て烟熏妆下的殇ゞ 提交于 2021-02-05 06:50:05
问题 So I have gridview pulling fields from a table and my hyperlinkfield is used to go to a specific page for that row to get more detailed data. Everything seems to work great except when the field used in the hyperlinkfield has an ampersand. I assume it is reading the ampersand as something else and so it doesn't bring up the proper info because the ampersand is in the name in the database. Hyperlinkfieldcode: <asp:HyperLinkField HeaderText="Name" Text="{0}" DataNavigateUrlFields="Name"

Gridview Hyperlinkfield using DataNavigateUrlFormatString with Ampersand

老子叫甜甜 提交于 2021-02-05 06:49:07
问题 So I have gridview pulling fields from a table and my hyperlinkfield is used to go to a specific page for that row to get more detailed data. Everything seems to work great except when the field used in the hyperlinkfield has an ampersand. I assume it is reading the ampersand as something else and so it doesn't bring up the proper info because the ampersand is in the name in the database. Hyperlinkfieldcode: <asp:HyperLinkField HeaderText="Name" Text="{0}" DataNavigateUrlFields="Name"

Get real path instead of 'fakepath' in file upload

天大地大妈咪最大 提交于 2021-02-05 06:12:26
问题 I face the following problem: When a user uploads a file with the HTML file input and I then want to receive the file path itself. I only get C:/fakepath/filename.txt for example. I understand that it is a security reason for browsers to know the exact path of the file. So i was wondering if it is even possible with some hack, some way in .net or with additional jquery/js plugin to get the full path of the file. Why ? We dont want to upload the file itself to our server filesystem, neither to

Get real path instead of 'fakepath' in file upload

╄→尐↘猪︶ㄣ 提交于 2021-02-05 06:11:50
问题 I face the following problem: When a user uploads a file with the HTML file input and I then want to receive the file path itself. I only get C:/fakepath/filename.txt for example. I understand that it is a security reason for browsers to know the exact path of the file. So i was wondering if it is even possible with some hack, some way in .net or with additional jquery/js plugin to get the full path of the file. Why ? We dont want to upload the file itself to our server filesystem, neither to

Force VB.NET to generate the same string comparison expression as C#?

人走茶凉 提交于 2021-02-04 19:37:45
问题 Somewhat similar question here: Difference between C# and VB.Net string comparison ...but not the same as the one I am asking now. I am creating a simple expression walker that will convert a lambda into an SQL WHERE clause. I call it like this: GetEntities<MyEntity>(e => e.MyProperty == MyValue) C# creates the expression as I would expect which is a BinaryExpression consisting of a MemberExpression on the left and a ConstantExpression on the right which looks like this: $e.MyProperty ==

Convert a string to decimal in VB.NET

好久不见. 提交于 2021-02-04 17:16:40
问题 What will be the easiest way to convert a string to decimal? Input: a = 40000.00- Output will be 40,000.00- I tried to use this code: Dim a as string a = "4000.00-" a = Format$(a, "#,###.##") console.writeline (a) 回答1: Use Decimal.Parse to convert to decimal number, and then use .ToString("format here") to convert back to a string. Dim aAsDecimal as Decimal = Decimal.Parse(a).ToString("format here") Last resort approach (not recommended): string s = (aAsDecimal <0) ? Math.Abs(aAsDecimal)

Convert a string to decimal in VB.NET

被刻印的时光 ゝ 提交于 2021-02-04 17:16:27
问题 What will be the easiest way to convert a string to decimal? Input: a = 40000.00- Output will be 40,000.00- I tried to use this code: Dim a as string a = "4000.00-" a = Format$(a, "#,###.##") console.writeline (a) 回答1: Use Decimal.Parse to convert to decimal number, and then use .ToString("format here") to convert back to a string. Dim aAsDecimal as Decimal = Decimal.Parse(a).ToString("format here") Last resort approach (not recommended): string s = (aAsDecimal <0) ? Math.Abs(aAsDecimal)