vb.net

How do you check if an input is a negative number in VB

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-10 19:46:49
问题 I am trying to do some validation which checks if the value in a textbox is an integer then checks if the the value is negative. It correctly checks if the value is an integer but I can't get it to check if the value is negative. Note: The value being entered is the number of competitions attended so comps = competition etc... Dim comps As Integer Dim value As Double If Integer.TryParse(txtCompsEntered.Text, integer) Then value = txtCompsEntered.Text If value < 0 Then lblcompsatten.ForeColor

Using a Javascript alert in VB.Net

时光毁灭记忆、已成空白 提交于 2021-02-10 18:25:35
问题 Basically I am looking to create a JavaScript alert in my code because I am displaying this web application in a mobile browser (off a tablet) and well the normal... Try ' ... Catch ex As Exception Messagebox.Show("Insert Text Here") End Try doesn't work in a mobile browser, so I've been told to use a JavaScript alert but I have no idea where to start on this, yes I have used a little JS in the past and still trying to learn it but never came across using an alert . So here is my code below,

using windows forms execute a .exe file

送分小仙女□ 提交于 2021-02-10 16:21:41
问题 I want to execute a .exe file which starts my node.js app using windows forms(vb.net) on a button click. I am using Process.Start("C:\Users\PROG21\Desktop\chat\start.exe") The problem is it starts the command window and just within 3-4 seconds it automatically closes.Why is that so? This is happening only with Node.js app ,the other .exe files run smoothly through this code. And also on other button click i want to close the command window terminating the Node.js app.How can i achieve it? Any

using windows forms execute a .exe file

坚强是说给别人听的谎言 提交于 2021-02-10 16:19:48
问题 I want to execute a .exe file which starts my node.js app using windows forms(vb.net) on a button click. I am using Process.Start("C:\Users\PROG21\Desktop\chat\start.exe") The problem is it starts the command window and just within 3-4 seconds it automatically closes.Why is that so? This is happening only with Node.js app ,the other .exe files run smoothly through this code. And also on other button click i want to close the command window terminating the Node.js app.How can i achieve it? Any

Delete selected row from DataGridView and MS-Access Database

人盡茶涼 提交于 2021-02-10 15:04:55
问题 I am trying to delete the selected row from DataGridView and MS-Access database.. Private Sub ButtonEditDelete_Click(sender As Object, e As EventArgs) Handles ButtonEditDelete.Click If Not Connection.State = ConnectionState.Open Then Connection.Close() End If Try If Me.DataGridViewEdit.Rows.Count > 0 Then If Me.DataGridViewEdit.SelectedRows.Count > 0 Then Dim intStdID As Integer = Me.DataGridViewEdit.SelectedRows(0).Cells("Username").Value Connection.ConnectionString = "Provider=Microsoft.ACE

Attaching a screenshot to new email outlook image with vb net

随声附和 提交于 2021-02-10 14:35:25
问题 been looking for a bit of code to take a screenshot and attach the screenshot to new email. I'll post what I have. It work 99%, just can't for the life of me figure out why it isn't attaching to the email. It does everything but attach the new screenshot to the email. Is this possible? Private Sub testStripMenuItem_Click(sender As Object, e As EventArgs) Handles testStripMenuItem.Click Dim maxHeight As Integer = 0 Dim maxWidth As Integer = 0 For Each scr As Screen In Screen.AllScreens

mysql push notification

允我心安 提交于 2021-02-10 14:28:40
问题 Reading that MySQL doesn't have similar to SqlDependency . What is the best snippet to notify other users if a cell changed? Most of the current posts suggest pooling as recommended approach but can't find proper code to study for VB.NET Winform without using third party service such Nub. What I guess could work is to create a CRON job at http server to fetch if that cell(s) changed then store a flag in a secure file; then rather than keep checking MySQL database on interval; watch that flag

Change File Extension on Multiple Files

不打扰是莪最后的温柔 提交于 2021-02-10 14:25:49
问题 I have some file in a folder. D:\Text\Text.FL D:\Text\Text1.FL D:\Text\Text2.FL i want to rename extension " .FL " to " .txt " I've tried with this code My.Computer.FileSystem.RenameFile("D:\Text\Text.fl","Text.txt") but I want to shorten that code 回答1: You want to shorten one line of code? You can call File.Move if you import the System.IO namespace but you would need to pass two full paths in that case. Maybe what you actually mean is that you don't want to have to write out a line like

Change space between Image and Text in ContextMenuStrip

ⅰ亾dé卋堺 提交于 2021-02-10 12:43:27
问题 In my application, I have a ContextMenuStrip with two items. Each item has an image and a text. There's a default gap between the Image section of the Menu Items and their text, as shown in the image below (the gap is indicated by red arrows). I want to reduce the horizontal gap by moving the text towards the left, so that the gap is reduced to a maximum of 1 pixel. Is it possible? If yes how can I? 回答1: A sample setup that shows how to handle a generic ToolStripProfessionalRenderer and a

Combobox DataBinding Bug - Won't write value if programmatically losing focus

守給你的承諾、 提交于 2021-02-10 12:03:46
问题 I have a blank form, to which I've added a default ComboBox , TextBox (just for receiving focus), and Label . The combobox has a databinding set up to a private property on the form. Setup: Private Sub FormLoad(sender As System.Object, e As System.EventArgs) _ Handles MyBase.Load Dim data = {New With {.Display = "", .Value = ""}, New With {.Display = "A", .Value = "A"}, New With {.Display = "B", .Value = "B"}, New With {.Display = "C", .Value = "C"}} ComboBox1.DataSource = data ComboBox1