vb.net,visual-studio,msgbox , How would I make a different MsgBox appear after the user saw the first one?


How would I make a different MsgBox appear after the user saw the first one?

Question:

Tag: vb.net,visual-studio,msgbox

I was wondering how to make it so when a user clicks a button, then a MsgBox appears, for example, with the word "cat". Now, since the user saw the word cat, if he would click the button again, for the rest of the time the program is open, it would say "You already know there is a cat here!".

How would I go about this, as is it possible?


Answer:
Private Dim AlreadySawTheCat as Boolean = False

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  If AlreadySawTheCat Then
    MessageBox.Show("You already know there is a cat here!")
  Else
    MessageBox.Show("There is a cat here!")
    AlreadySawTheCat = True
  End If
End Sub

Related:


Use String to find my.resources


vb.net
I have a number of resources called My.Resources.diceDark1 My.Resources.diceDark2 My.Resources.diceDark3... I want to do something like For i as integer = 1 to 10 button1.backgroundimage = My.Resources.diceDark i Next So it will cycle through all the resources and change the background image to that...

ZipEntry() and converting persian filenames


vb.net,persian,sharpziplib
In my vb.net project I'm trying to add a file with a Persian name to a zip file and I do this with the code bellow: Dim myentry As New ZipEntry(dr.Item("MyFile").ToString()) zipOut.PutNextEntry(myentry) however when I open the zip file I see the file name is changed to a gibberish Is...

How do I use VB.NET to send an email from an Outlook account?


vb.net,email
I'm trying to send an email via an outlook email account through a vb.net program. When I run the code I get an error telling me that I don't have a secure connection. I've been searching online and have tried all the adjustments I've found but I'm still not having...

Get List of Elements in Tree with specific Field Value


vb.net,linq,properties,interface
I have an Interface like this: Public Interface TreeSelectorAttributes Property selectedInTreeSelector As Boolean Property Name As String ReadOnly Property childs As IEnumerable(Of TreeSelectorAttributes) End Interface and I have a TreeView which has a List of this TreeSelectorAttributes: Public Property rootList As IEnumerable(Of TreeSelectorAttributes) now after the User chooses which elements...

WPF style info from external text file


wpf,vb.net,styles
Not sure if this is possible, but I have a WPF application that now has a requirement to be skinnable. Basically, this equates to several key colours and a couple of logos. Is there any way of grabbing the hex values for the colours in defined styles from an external...

Connecting to database using Windows Athentication


sql-server,vb.net,authentication,connection-string
I would like to use window authentication in my program to connect to my sql server. users already have certain permissions on the SQL server and I would like to leverage that in my program. The way I currently connect to the server is using this connection string. Dim ConnectionString...

Automapper AfterMap function initialising classes


.net,vb.net,automapper
Can anyone please explain how does the AfterMap function initalises the class objects passed in the lambda expression? When i run this bit of code as myself, it populates the dest object with my details. i can't figure out how is it doing that? but if someone can tell me...

nuget security - malware installed by nuget packages?


visual-studio,nuget
Is it possible that you can be infected with malware by installing nuget packages? This is especially interesting when you think of Microsoft Visual Studio 2016 which will be fully dependent on Nuget....

Removing Alert When Using DeleteFile API


vb.net,vba,api,delete
I'm writing a VBA application which involves looping a large number of directories recursively. I am using the FindFirstFile API to to achieve this, as it offers a substantial performance boost over the FileSystemObject. In order to remove the FSO from my code entirely, I need a routine to delete...

Return index of word in string


arrays,vb.net,vbscript
This code: Module Module1 Sub Main() ' Our input string. Dim animals As String = "cat, dog, bird" ' See if dog is contained in the string. If Not animals.IndexOf("dog") = -1 Then Console.WriteLine(animals.IndexOf("dog")) End If End Sub End Module Return start position 5 in string But how to return...

Convert Double from String


asp.net,vb.net,visual-studio-2012,converter
When converting string to floating, the converter creates wrong results. ?Global.System.Convert.ToDouble("635705821821928755").ToString("0") "635705821821929000" ?Global.System.Convert.ToSingle("635705821821928755").ToString("0") "635705800000000000" I am working with VB.Net Visual Studio 2012, Framework 4 on ASP.Net Webpage. Is there any solution for converting huge numbers from string into floating?...

How to make existing forms deriven from a base form in VB.net


vb.net,inheritance
I have an existing project in VB.net with many Windows forms.I want to change all forms to deriven from a base form created in a class library. is there any way to do so? if i do inheritance with a code like this the designer dose not show the child...

Convert date to string format


vb.net,converter
I have successfully imported data from xls into dataGridView. The date column in dataGridView is showing the DateTime format. I want this date column to be displayed in "dd MMM yyyy" format. I have tried as shown below: connExcel.Open() Dim dtExcelSchema As DataTable dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing) Dim SheetName As...

Custom drawing using System.Windows.Forms.BorderStyle?


c#,.net,vb.net,winforms,custom-controls
I want to mimick drawing of default border based on value of property BorderStyle. Instead of single border around the control, my control is visualised as four adjacent custom-drawn boxes (2×2), each having standard border drawn individually. So for example, if Control.Border is set to FixedSingle value I want to...

Use Sync Framework without Installation


c#,visual-studio,microsoft-sync-framework
I developed an application, which uses the Microsoft Sync SDK for syncing Directories. But I want to run the application without installing the sync framework on every computer before. So is there a way to publish the application, including the framework in his program directory?

.NET use IIF to assign value to different variables


.net,vb.net,conditional,variable-assignment,iif
Could I (and if so how) do the following in .NET language (more specifically VB.NET): Dim a,b as Integer if(somecondition=1,a,b) = 12345 Or any variant with IIF would be fine by me. Basically I'm always assign the same value but never to the same variable.....

Retrieve full path of FTP file on drag & drop?


vb.net,ftp
I can read the filename using next code when dragging a file from an Ftp folder browsed on Windows explorer. But is there a way to retrieve the full Ftp path? Private Sub DataGridView1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles DataGridView1.DragDrop Dim filename As String = "" If e.Data.GetDataPresent("UniformResourceLocator") Then...

vb.net AES decryption returns “data is incomplete block”


vb.net,encryption,cryptography,aes
I'm aware of the other thread on this issue (AES decryption error " The input data is not a complete block." Error vb.net), but I'm either not implementing the solutions offered there correctly, or something about my particular variant of this issue isn't covered by those solutions. In any event...

How to execute four queries once and then check success or failure?


vb.net,windows,visual-studio-2010,ms-access
I need to execute four queries and then if there is success must return true otherwise false. The queries affect the database but the function returns false Private Function save_to_data() Dim success As Boolean = False Dim conn As OleDbConnection = GetDbConnection() Dim total_due As Decimal = sanitize(txt_total_due.Text) Dim amount_paid...

Filtering Last Duplicate Occurrence In A Datatable


c#,vb.net
I am sorting a datable with the following code.. Dim sortedExtRecords1 As DataTable sortedExtRecords1 = parsedDataset.Tables("Detail").Clone Dim dvParsedDataset1 As New DataView(parsedDataset.Tables("Detail")) dvParsedDataset1.Sort = AuthorizatonConstants.Authorization_ID sortedExtRecords1 = dvParsedDataset1.ToTable("Detail") I can further filter the results to only return non duplicates and if there is duplicates I want the last record of the...

Include file in solution explorer without it being a build dependency


c#,visual-studio,msbuild,intellisense
How can I include a file in the list of files in solution explorer without including it as a dependency for compilation? I have a .targets file that generates .cs files, similar to the examples in this answer. <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateCode</CoreCompileDependsOn> </PropertyGroup> <ItemGroup> <Sources Include="..\sources\*.txt" /> </ItemGroup> <Target Name="GenerateCode"...

How to pass all value of ListBox Control to a function?


vb.net,listbox
I am writing a simple application to read the value a textbox and add to a listbox control . But i have to pass the listbox control to function . Any suggestion ? Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load test("E:\Satyajit.txt") End Sub Public Function...

Visual Studio 2013 LINK : fatal error LNK1181: cannot open input file


c++,visual-studio,opencv,visual-c++,visual-studio-2013
I am using Visual Studio 2013. I'm trying to build some code given to me from my professor and I keep getting this error: LINK : fatal error LNK1181: cannot open input file 'C:\Users\manduchi\Documents\eyegaze\EyeGazeDemo..\Libraries\OpenCV\lib\opencv_core249.lib' However, on my computer opencv_core249.lib is located somewhere else. I've tried updating the linker directories to...

Get XML node value when previous node value conditions are true (without looping)


xml,vb.net,linq-to-xml
Sample XML - <?xml version="1.0"?> <Root> <PhoneType dataType="string"> <Value>CELL</Value> </PhoneType> <PhonePrimaryYn dataType="string"> <Value>Y</Value> </PhonePrimaryYn> <PhoneNumber dataType="string"> <Value>555-555-5554</Value> </PhoneNumber> <PhonePrimaryYn dataType="string"> <Value>Y</Value> </PhonePrimaryYn> <PhoneType dataType="string"> <Value>HOME</Value> </PhoneType>...

VB.net: How to define a namespace where the first segment is NOT the file name?


vb.net
Suppose I have a project called FooProject with a file called FooModel.vb which contains the following interfaces: Namespace Foo.Model Public Interface Foo ' ... End Interface Public Interface Bar ' ... End Interface End Namespace When I output this to a class library and import the DLL, the namespace I...

Regex to check if string is alphanumeric separated by commas or a single alphanumeric string


regex,vb.net
I have the following right now which works fine if the string is alphanumeric and separated by commas, but it doesn't work if I only have a single string. "^([a-zA-Z0-9]+,)+[a-zA-Z0-9]+$" Works for something like "1A,1B,1C", doesn't work on "1A" Sorry, I don't know much about regex and I only got...

Can't output Guid Hashcode


sql,vb.net,guid,hashcode
I'm trying to use the hashcode of a guid as a random voucher name for a website, and have been trying to write new records to a SQL table with the Hashcode variable but it doesn't work. command.Parameters.Add("@voucherName", SqlDbType.NVarChar) command.Parameters("@voucherName").Value = Guid.NewGuid().GetHashCode() When using that code it just puts a...

How to map Visual Studio shortcut keys in Github Atom


visual-studio,coffeescript,atom-editor
How to map the shortcut keys in GitHub Atom just like Visual Studio. If anyone have keymap file kindly share. I tried to implement (Ctrl+K ,Ctrl+C) in github atom for comment. It didnt work. Also Ctrl-K,Ctrl-U to turn off comment 'atom-text-editor': 'ctrl-k+ctrl-c': 'editor:toggle-line-comments' ...

Comparing arrays with numbers in vb.net


arrays,vb.net
I need a way to compare two arrays in vb.net and save result in third array: Dim KonRes(3) As Integer Dim UserRes(3) As Integer Dim YelRed(3) As Integer KonRes(0) = 1 KonRes(1) = 2 KonRes(2) = 3 KonRes(3) = 4 UserRes(0) = 4 UserRes(1) = 3 UserRes(2) = 2 UserRes(3)...

Gridview items not populating correctly


asp.net,vb.net
I have data I am trying to input into a gridview. I am looking up the number of rows for the gridview and adding data into them like this: My "test" however does not get populated into the Submitted and Variance BoundFields in the Gridview. All that populates is the...

How to Customize Visual Studio Setup


c#,visual-studio,setup-project
I have created a video chat application in c#. Now I wan to make a setup of it. I have created a setup using Visual studio's setup project but my client told me to customize the setup progress bar styles and other properties. i dont know how to do it....

Syntax error in Insert query in Mysql in VB.Net


mysql,vb.net
I am doing project in VB.NET and backend is mysql Can you please tell me where the error is occured Public Sub ins() con.Open() Dim cmd1 As New OdbcCommand("insert into party values('" + pcode_txt.Text + "','" + Trim(UCase(name_txt.Text)) + "','" + Trim(UCase(addr_txt.Text)) + "','" + phone_txt.Text + "','" + combo_route.SelectedItem...

Set Label From Thread


vb.net,multithreading,winforms
Form1.vb Imports System.Threading Public Class Form1 Dim demoThread As Thread Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Start As New Class1 Me.demoThread = New Thread( _ New ThreadStart(AddressOf Start.ThreadProcSafe)) Me.demoThread.Start() End Sub Delegate Sub SetTextCallback([text] As String) Public Sub SetText(ByVal [text] As String) ' InvokeRequired required...

check if a list contains all the element in an array using linq


vb.net,linq
I have a list of objects and I have an array of keywords. I need to check if all the elements of the array are present inside the list of objects. The user enters the data to be searched like this pain+fever+thirst+itching My code looks like: //i check if the...

Exception in async task gets intercepted in Visual Studio


c#,visual-studio,exception,asynchronous
I want to run several tasks, some of which would complete async'ly, and then wait for all of them to complete. As the tasks may throw exceptions, I want to catch and log them. sample code for that: static async Task doit(int x) { try { Console.WriteLine("{0} {1} start", x,...

How do I make visual studio show exceptions that any method may throw?


c#,visual-studio
I was wondering about how I can make visual studio show the exceptions that any method may throw, not just the .NET Framework methods (I am using C#). For example, here's a picture showing that when I hover over Console.WriteLine it says "Exceptions: System.IO.IOException". However when I do that for...

Formatting a drive in Visual Basic?


vb.net,format,drive
I have a ListBox that is being populated only with removable drives. The user selects the drives to be formatted and then the program should format those drives. However, I get the message that the specified file cannot be found. Here is my code. Public Class Form1 Private Sub Form1_Load(sender...

Visual Basic Datagrid View change row colour


vb.net,datagridview,datagrid
Every other change to the datagrid view works fine but for some reason the row color just wont change. Ive debugged and my application goes through the loop to change the row color. Also I have a button that gives the datagrid view a new list and colors the rows...

C# SocketException was unhandled


c#,visual-studio,socketexception
I just went through a YouTube tutorial on tcpip servers and clients and was using the code from it: https://www.youtube.com/watch?v=uXFso7xSSWk both part 1 and part 2. I have redone the code twice and have made sure that everything is the same. Whenever I run the server I get the error...

Where to store an mp4 file in my project?


.net,vb.net,visual-studio,mp4
I have been studying vb.net for a couple of months now and I want to try something new. I have this sample project to try. It is a web browser and I want that if a button will be clicked, a video will play immediately. This is what my application...

NullReference Error while assiging values of Modeltype in MVC View (Razor)


vb.net,razor,model-view-controller,model
I have the following MVC Model: Public Class Employee Public Property EmployeeID As Integer End Class Controller: Namespace Controllers Public Class EmployeeController Inherits Controller Function Details() As ActionResult Dim employee As Employee employee = New Employee employee.EmployeeID = 101 Return View() End Function End Class End Namespace View: @ModelType MVCDemo.Employee...

Using Try/Catch block to set file path?


visual-studio,visual-studio-2013
I'm having a bit of trouble figuring out an assignment for my Visual Basic course. I am told to assume that a given text file is not in the \bin\Debug folder of my program, so I am trying to throw an exception error and get the correct path from the...

Scraping Javascript webpage (script error occurred)


javascript,html,vb.net,web,scrape
I am scraping a dynamic webpage which is a javascript based webpage. I have done codes which is used to load the webpage first in the program: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Navigate("http://www.changiairport.com/flight-info/flight-status/passenger-departures") End Sub However, each time I run the program, script...

VBMath using / equivalent in C# [closed]


c#,vb.net
I want to use something like VBMath.Randomize(); and VBMath.Rnd(); In C#, I tried with using Microsoft.VisualBasic; But this doesn't work...

How to uninstall a program using C#? [duplicate]


c#,visual-studio,visual-studio-2012,command-line,windows-installer
This question already has an answer here: How to uninstall MSI using its Product Code in c# 4 answers I'm trying to uninstall a program using C# via Visual Studio and possibly CMD. I made several attempts but could not getting anything to go. Attempt #1: RegistryKey localMachine =...

finding file in root of wpf application


c#,xml,wpf,visual-studio,relative-path
I'm trying to load a file with pack://application: The file is situated in the root of my project but I keep getting a null reference error. However When I do an absolute reference it finds the file and loads just fine. What am I missing here? This doesn't work var...

how can i use parameters to avoid sql attacks


sql,vb.net
I have a project without any parameters used in SQL queries. Is there any solution so that i don't have to change the function and validate parameters from the Query string itself? Query = "select * from tbl_Users where userName='"& textbox1.text &"' and password='"& textbox2.text &"' " ds = obj.ExecuteQueryReturnDS(Query)...

Generic Interface missing implementation


vb.net,interface,implements,generic-interface
I have a generic interface, even if I state the type when I implement it, it says the implemented classes misses all implementation of members. The interface Interface IBuilder(Of T) Function Number(ByVal literal As String) As T End Interface The implement Class BracketsBuilder Implements IBuilder(Of String) Public Function Number(number__1 As...

VB.Net DateTime conversion


jquery,vb.net,datetime
I have a jquery datepicker in a usercontrol. On the usercontrol i have a property that will return the selected date to the page which contains my usercontrol. I try to convert the string to a date: Dim MyDate As System.DateTime = System.Convert.ToDateTime(txtFromDateF.Value, System.Globalization.DateTimeFormatInfo.InvariantInfo) i keep getting the error: String...