w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » VB.NET » Page 1
This must be a easy answer but, I've reached the point to ask. VB.NET comparing 4 string numbers including time
DateTime.Now is a DateTime instance. So every method available for a DateTime are usable on Now. Including AddHours with a negative value If CallBackTime > "180000" OrElse CallBackTime < DateTime.Now.AddHours(-1).ToString("HHmmss") Also to avoid an unnecessary evaluation of the expression AddHours when the first condition is satisfied I suggest to use OrElse short circuit evaluation fea

Categories : Vb.Net

Counting user responses
The value of MsgBoxResult.Yes is 6. It is a constant - it will never change - and so (ironically) you will always end up inside the "You are optimistic" block. You need to declare a variable inside your function which you increment each time the user clicks Yes.

Categories : Vb.Net

How do I get text from web brwoser into a label in vb?
Try the following: YourLabel.Text = Wb.Document.GetElementById("yourId").GetAttribute("value") You'll have to provide the input tag in the HTML document with an id, though. If you're not in control of the HTML, take a look at GetElementsByTagName.

Categories : Vb.Net

Can the following line of code be explained
It's the same as If cboModule.SelectedIndex = 0 Then txtModule.Visible = True Else txtModule.Visible = False End If Since comparing cboModule.SelectedIndex with 0 returns a Boolean, you could also do. Dim b As Boolean b = (cboModule.SelectedIndex = 0) txtModule.Visible = b In VB it can be a little confusing since both setting a variable and comparing it uses the same operator.

Categories : Vb.Net

I cant change my form
try this Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Login As New Form2 Form2.Show() Me.dispose() End Sub it should solve the problem

Categories : Vb.Net

STAThreadAttribute with savefiledialog vb.nt
You could move everything concerning SaveFileDialog1 to Button3_Click and store the filename in a Private variable, so it can be used later in BackgroundWorker1_DoWork. Private _filename As String Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click SaveFileDialog1.Title = "Save Excel File" SaveFileDialog1.Filter = "Excel files (*.xls)|*.xls|Excel Files (*.xl

Categories : Vb.Net

Parsing a Variable from Form to Function
It's not clear what you are trying to do. Here's my input. Just add the logic to get the username into the button click event Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Input As Integer Input = Integer.Parse(Textbox1.Text) Dim currentADUser As System.DirectoryServices.AccountManagement.UserPrincipal currentADUser = System.DirectoryServ

Categories : Vb.Net

Undefined String in the last character of SerialPort ReadLine VB.Net [RESOLVED]
I have another solution and I think it's better solution then using NewLine property. Actually the character in the last string of barcode value is vbCr or vbLf, I don't know what that's mean, but I know it in the manual of barcode scanner. So to remove that character we can use mid function and replace that character with this string "".

Categories : Vb.Net

How to use CStr to convert generic parameter to String?
Every Object can ToString, so why dont you use that? Dim text = If(valueToInsert Is Nothing, "", valueToInsert.ToString()) _pptSld.Shapes(tbName).TextFrame.TextRange.Text = text You cannot use CStr on generics. The type of the parameter must be convertible to String which is not guaranteed in your case. That's why you get the compiler error. I wouldn't use those old VB functions anymore. There

Categories : Vb.Net

VB.Net Datagridview combobox add a handler
Simply check if editingComboBox.SelectedValue is Nothing. The DataGridView reuses only one ComboBox instance, and internally resets the DataSource of the ComboBox when the user selects another ComboBox cell. Then the event SelectedIndexChanged raises and SelectedValue will be Nothing at that time.

Categories : Vb.Net

Splitting a very large string in part
Some webbrowsers only support a maximum ammount of characters in a string (your string is about 27.700 characters long). Here is a link to an article about those url-limits on browsers. So here's one question: Do you really need ALL of that information sent to your PHP-page? Possible solution: Try to shrink repeating characters (all those A's for instance) to a shorter version. "Ax467" instead of

Categories : Vb.Net

VB.Net Self Deletion after 5 days
you might do the following 1- create a windows service application, check this link to get more information Developing Windows Service Applications 2- use timer , check this link to get more information Windows service and timer hope this will help you

Categories : Vb.Net

My Crystal Report is not showing the hole list
modify your method as below if i understood what do you want>>> Dim DT As DataTable = Sql.ExecuteDataTableSP("SelectWorking") For Each Data As DataRow In DT.Rows CRPT.SetParameterValue("ID", Data(1))

Categories : Vb.Net

Visual Basic For Loop how to compare listbox to another listbox?
Your existing two routines already provide the foundation for what you need to do. For example, you're already looping through the items in the first list in your averaging routine. Now, just compare each to your average, and populate the second list if they are greater, similar to how you populate the first list. For i As Integer = 0 To (listScores - 1) If (CDbl(lstListofScores.Item

Categories : Vb.Net

How to programatically populate a DataGridViewComboBoxColumn in VB.net?
If you have a DataSource in your combobox, you can do this Dim dgvcc As New DataGridViewComboBoxCell With dgvcc .DataSource = answerStr .ValueMember = "CampaignAnswerId" .DisplayMember = "Answer" End With DataGridViewName.Item(columnIndex, rowIndex) = dgvcc or you can just do this Dim dgvcc As New DataGridViewComboBoxCell dgvcc.Items.Add("test1") dgvcc.Items.Add("test2") dgvcc.Items.

Categories : Vb.Net

For Next Loop that computes wrong?
Instead of: decIncrementedYearlyWage += (decYearlyWageComputed + decYearlyWageComputed * decExpectedRaiseComputed) which is going to give the same result each iteration because the values in the formula don't change, you might be looking for something like this: decIncrementedYearlyWage += (decIncrementedYearlyWage * decExpectedRaiseComputed)

Categories : Vb.Net

VB Program not working, should be simple
My VB is rusty, but you're not by any chance trying to convert "50,000" to a number, and it's failing because it has a comma in it? Most string -> int and string -> float conversions (in other languages) don't like commas.

Categories : Vb.Net

Age based "Select Case"
Then get the value from the right place, and use some code protection with Integer.TryParse since your reading from a string. Private Sub btnSelect_Click(sender As Object, e As EventArgs) Handles btnSelect.Click Dim age As Integer If Integer.TryParse(txtage.Text, age) Then Select Case age Case 0 To 3 lblPrice.Text = "0" Case 4 To 63 lblPrice.Text = "9" End

Categories : Vb.Net

How can I Parse text document in VB,Net for values?
Assuming your files are flawless... One way to do it : Imports System.IO Dim AllLines() As String = File.ReadAllLines(FilePath) Dim DatasIndex As Int32 = -1 For i As Int32 = 0 To AllLines.Length - 1 If AllLines(i).StartsWith("T") OrElse AllLines(i).StartsWith("t") Then If AllLines(i).ToUpper().StartsWith("TIMESTAMP: ") Then DatasIndex = i

Categories : Vb.Net

VB.Net: "Nice", maintainable way of matching integer error code to error strings for UI
It's easy to do this with an .xml file. That or some similar file format would be my preference. Some people would prefer using app.config or file format. When I evaluate something like this, simplicity of maintenance is probably the highest priority, and there are several methods that would work equally well in this regard. A database table could be used, but it seems like an overcomplication.

Categories : Vb.Net

Create small datasource with only 3 items
Use the ITEMS property to add static items. Maybe utilize their online help or search using google <dx:ASPxRadioButtonList ID="ASPxRadioButtonList1" runat="server" SelectedIndex="0"> <Items> <dx:ListEditItem Selected="True" Text="Option1" Value="Option1" /> <dx:ListEditItem Text="Option2" Value="Option2" /> <dx:ListEditItem Text="Both" Value=

Categories : Vb.Net

Is there a way to start over in a For Each?
You could use a plain for loop instead, and set the iterator back to it's initial value. It's probably best that you restructure this to be more efficient though, is there any point looping the first time if the option is selected?

Categories : Vb.Net

Check if function is true without calling it
By definition you cannot! You may need to split your operation into two parts: Function checkXX to see if something needs to be done Function do it, to actually do the work Alternatively, Simply call the function and have it do its work once, depending on the "true / false" condition you are testing for.

Categories : Vb.Net

How to create a Dictionary(TKey, TValue) property
You want a function (or Sub in this case for VB) not a property as properties can only get or set a single value. Public Sub AddValues(ByVal val1 As Decimal, ByVal val2 As Decimal, ByVal val3 As Decimal) _dic.Add("Value1", val1) _dic.Add("Value2", val2) _dic.Add("Value3", val3) End Sub And then: AddValues(1,2,3)

Categories : Vb.Net

Save file path on access field
Assuming everything else is working, I think you may have to pass your second parameter, sPath, ByRef explicitly. So: Public Function Filename(ByVal strPath As String, ByRef sPath As String) As String sPath = Left(strPath, InStrRev(strPath, "")) Filename = Mid(strPath, InStrRev(strPath, "") + 1) End Function If you pass it by value, only the value is passed and not the address, so the

Categories : Vb.Net

parse log file delimited by space
There are a couple of ways to handle this. One way is use Try/Catch to ignore or repair any lines with improper formats. Another way is to read each line as a string and parse it yourself in the program using regex or string manipulation.

Categories : Vb.Net

for each word in textbox do this code
You need to split the TextBox1.Text contents into words, and loop over the words: For Each word As String In TextBox1.Text.Split({" "c}, StringSplitOptions.RemoveEmptyEntries) Select Case word Case "run" 'Code Case "ok" 'Code End Select Next

Categories : Vb.Net

Running sql script from Windows Forms Application
It looks like you may be using an obsolete version of the SMO library, as explained here: http://stackoverflow.com/a/11286124/109122. Update: If the config setting recommended at the link does not work, try this simpler one instead: <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup> Unfortunately, it appears that the confi

Categories : Vb.Net

Using SMO with VS2013 Windows Desktop application project
I am assuming you are using nuget?? It appears that you must have 2014 installed, search for this in your installed packages and click uninstall. Now try and install the 2012 version. Or in the Package Manager Console: Uninstall-Package Unofficial.Microsoft.SQLServer.SMO.2014 Followed by: Install-Package Unofficial.Microsoft.SQLServer.SMO http://www.nuget.org/packages/Unofficial.Microsoft.SQ

Categories : Vb.Net

Files in directory sort by fileName ascending - for each
You could use LINQ with File.GetCreationTime: Dim orderedByCreation = From file In Directory.EnumerateFiles(Path, SearchPattern) Let createdAt = System.IO.File.GetCreationTime(file) Order By createdAt Ascending Select file For Each filePath As String In orderedByCreation PrintJOBFile(filePath) Next Note that you could

Categories : Vb.Net

Why can't my function return a true value?
It would be more helpful, as Tim mentioned (+1 for Option Strict), to know what ScalarQuery does. Going under the assumption that your ScalarQuery performs an ExecuteScalar on a SQL query, it will return the first column of your query. In this case, it looks like you passed in 'Admin' and it's corresponding password. Since your supplied query is selecting the Username column as the first ordina

Categories : Vb.Net

How to change progress bar value by dragging mouse in vb.net
A progress bar is not the correct control to use for this. You should use a TrackBar instead. But it can be made to work, with about -10 elegance points. The trickiest problem with ProgressBar is that it animates progress. That makes it slow to respond to your mouse moves. That animation can be disabled, but not perfectly. Closest you can get is: Private Shared Sub ChangeProgress(bar As Pro

Categories : Vb.Net

Workaround for the same namespace defined in two assemblies using VB.NET
You can alias your namespaces in the import like this: Imports [ aliasname = ] namespace -or- Imports [ aliasname = ] namespace.element IE Imports strbld = System.Text.StringBuilder Imports dirinf = System.IO.DirectoryInfo Public Function GetFolders() As String Dim sb As New strbld Dim dInfo As New dirinf("c:") For Each dir As dirinf In dInfo.GetDirectories() sb.Append(d

Categories : Vb.Net

Solved - Read, Get, Compare and Count Rows from GridView VB.net?
I got the answer, hope to be useful to all of you, thanks, here it goes: Dim texto_periodicidade As String Dim valor As String Dim flag_validacao As Boolean = False Dim contador_falso As Integer contador_falso = 0 For Each linha As GridViewRow In GridView_Manutencao.Rows texto_periodicidade = CType(linha.FindControl("Label_Periodicidade"), Label).Text

Categories : Vb.Net

Printing an external PDF document in VB.net
First, to be able to select a Printer, you'll have to use a PrintDialog and PrintDocument to send graphics to print to the selected printer. Imports System.Drawing.Printing Private WithEvents p_Document As PrintDocument = Nothing Private Sub SelectPrinterThenPrint() Dim PrintersDialog As New PrintDialog() If PrintersDialog.ShowDialog(Me) = System.Windows.Forms.DialogRes

Categories : Vb.Net

Shipping Cost Extra
As mentioned in my comment.... You say you need to add an oversize rate of $5 but this line OversizeDecimal = ShippingCostDecimal * OVERSIZE_RATE_DECIMAL seem to be multiplying by 5 Try OversizeDecimal = ShippingCostDecimal + (OVERSIZE_RATE_DECIMAL * QuantityInteger)

Categories : Vb.Net

Async event handler - flycapture from PointGrey
Starting a task and then immediately blocking on it (via Wait) nets you nothing. You may as well just run the saving-image code directly. The second example is actually asynchronous. You're probably getting an exception because the ManagedImage argument or one of its child objects is being disposed. Remember that the code raising the event has no idea that your code is asynchronous; it's up to yo

Categories : Vb.Net

Update listview from multiple threads in vb.net
You can use background workers and wait for each task to finish before calling the next one like this: Private worker_1 As new BackgroundWorker() Private worker_2 As new BackgroundWorker() AddHandler worker_1.DoWork, AddressOf worker_1_DoWork AddHandler worker_1.RunWorkerCompleted, AddressOf worker_1_RunWorkerCompleted AddHandler worker_2.DoWork, AddressOf worker_2_DoWork AddHandler worker_2.Run

Categories : Vb.Net

VB.NET Winsock HTTPS Post And Get Request
The correct way to handle this is to not use the WinSock control directly at all. .NET has System.Net.Http.HttpClient and Windows.Web.Http.HttpClient classes, both of which support HTTP and HTTPS requests. Use them instead of the WinSock control.

Categories : Vb.Net




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.