vb.net

How validate decimal with optional percentage symbol using Regex?

纵然是瞬间 提交于 2021-02-11 05:28:18
问题 As the title of the question, I need to validate regex using the following values​​: (Maximum 2 decimal places, and 9 integers) with an optional percent symbol. Valid: 10% 0% 1111111.12% 15.2% 10 2.3 Invalid: .% 12.% .02% % 123456789123.123 I tryed: ^[0-9]{0,9}([\.][0-9]{0,2})\d[\%]{0,1}?$ But It does not work as I want. 回答1: try this ^\d{1,9}(\.\d{1,2})?%?$ I tested over rubular and it is ok for your set of example. 回答2: Try this: ^[0-9]{1,9}([\.][0-9]{1,2})?[\%]?$ 来源: https://stackoverflow

Set Mediaelement Source to Relative URI in WPF Code

这一生的挚爱 提交于 2021-02-11 05:02:06
问题 I have a project that is WPF4 and VB.net. I'm trying to set a mediaelement's source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure out how to set the source to a relative URI in WPF. I know how to do it in VB.net, but by setting the source there, I can't have the media looping. How do I set the source of a mediaelement in a mediatimeline to a relative URI? 回答1: See the MSDN reference to the MediaElement.Source property. Make

Set Mediaelement Source to Relative URI in WPF Code

冷暖自知 提交于 2021-02-11 04:59:41
问题 I have a project that is WPF4 and VB.net. I'm trying to set a mediaelement's source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure out how to set the source to a relative URI in WPF. I know how to do it in VB.net, but by setting the source there, I can't have the media looping. How do I set the source of a mediaelement in a mediatimeline to a relative URI? 回答1: See the MSDN reference to the MediaElement.Source property. Make

Set Mediaelement Source to Relative URI in WPF Code

不羁的心 提交于 2021-02-11 04:58:19
问题 I have a project that is WPF4 and VB.net. I'm trying to set a mediaelement's source using a mediatimeline (inside a storyboard construct), so I can loop the mediaelement. However, I cannot figure out how to set the source to a relative URI in WPF. I know how to do it in VB.net, but by setting the source there, I can't have the media looping. How do I set the source of a mediaelement in a mediatimeline to a relative URI? 回答1: See the MSDN reference to the MediaElement.Source property. Make

StringAlignment.Justify in VB?

回眸只為那壹抹淺笑 提交于 2021-02-10 21:58:46
问题 I've been trying to print some documents in VB, and I've been doing just fine... until I realize I need my documents printed in Justify. This is the code I use in my PrintDocuments: Dim drawcenter As New StringFormat drawcenter.Alignment = StringAlignment.Center e.Graphics.DrawString("Terms and Conditions of Service", New Font("Times New Roman", 13, FontStyle.Bold Or FontStyle.Underline), New SolidBrush(Color.Black), New RectangleF(50, 50, 700, 30), drawcenter) Is there a way to replace

Adding text in an image vb.net

二次信任 提交于 2021-02-10 20:45:55
问题 I am new to vb.net and I want to add some text on the image but it seems my code is not working at all. Public Class Form1 Dim Graph As Graphics Dim Drawbitmap As Bitmap Dim Brush As New Drawing.SolidBrush(Color.Black) Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As EventArgs) Drawbitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height) Graph = Graphics.FromImage(Drawbitmap) PictureBox1.Image = Drawbitmap Graph.SmoothingMode = Drawing2D.SmoothingMode

Moving PictureBox using Timer

假如想象 提交于 2021-02-10 20:15:19
问题 Basically what I'm trying to do is to make a picture box go up, then left, then down, then right, all based on timer ticks. I'm fairly new so I don't really know what's wrong. If you guys could give a simple answer or a better approach, that'd be great. Dim slides As Integer slides += 10 If slides < 20 Then PictureBox1.Left += 10 ElseIf slides > 20 AndAlso slides < 40 Then PictureBox1.Top += 10 ElseIf slides > 40 AndAlso < 60 Then PictureBox1.Left -= 10 ElseIf slides > 60 AndAlso < 80 Then

Listing all sub directories in VB.net

我怕爱的太早我们不能终老 提交于 2021-02-10 19:57:24
问题 can anyone tell me how to list all subfolders in vb.net. i want to put it on a listbox, i have created a code but it only search on the current location, and does not include subfolder. here is my code,, Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim dnum, fnum As Integer For Each drive As String In Directory.GetLogicalDrives() ListBox1.Items.Add(drive) Next drive Do While dnum < ListBox1

.NextResult() method does gives an error that states that no data is present

こ雲淡風輕ζ 提交于 2021-02-10 19:50:53
问题 Can you check my coding and let me know what I'm doing wrong? I'm trying to use the .NextResult() method of a DataReader but I get an error that no data is present. The 1st query returns a value but the 2nd query is the problem. Dim strSqlStatement As String = "Select Count(*) As TotalRows " & _ "From Parents " & _ "Where (FatherName = @SearchValue " & _ " Or MotherName = @SearchValue);" strSqlStatement = strSqlStatement & "Select FatherName, MotherName " & _ "From Parents " & _ "Where

.NextResult() method does gives an error that states that no data is present

醉酒当歌 提交于 2021-02-10 19:50:41
问题 Can you check my coding and let me know what I'm doing wrong? I'm trying to use the .NextResult() method of a DataReader but I get an error that no data is present. The 1st query returns a value but the 2nd query is the problem. Dim strSqlStatement As String = "Select Count(*) As TotalRows " & _ "From Parents " & _ "Where (FatherName = @SearchValue " & _ " Or MotherName = @SearchValue);" strSqlStatement = strSqlStatement & "Select FatherName, MotherName " & _ "From Parents " & _ "Where