spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » VB.NET » Page 1
Set Crystal Reports Jet database password programmatically
you can add it to your App or Web config as keys like: <add key="ServerName" value="YourServer"/> <add key="DataBaseName" value="WorkingDataBase"/> <add key="DatabaseUser" value="DBUser"/> <add key="DatabasePassword" value="DBPassword"/> and call them in your code like: Dim SERVER_NAME As String = ConfigurationManager.AppSettings("ServerName").ToString() Dim DATABASE_NA

Categories : Vb.Net

resize control.size width designer in vb.net winform ,but this action affected other control size
Maybe you are accidentally selecting the other label, or maybe selecting both? Otherwise, I think you should try Label1.Autosize = False Here are 2 samples on ways to change a label's size (You can Import System.Drawing to make it cleaner) Label1.Size = New Size With {.Width = 50, .Height = 89} Label1.Size = New Size(50, 89) If that doesnt answer your problem, you might have to explain a li

Categories : Vb.Net

Overflow Exceptions was unhandled
Integer (Int32) = 2,147,483,647 max value Long (Int64) = 9,223,372,036,854,775,808 Double = 1.7*10^308 You might want to try NOT using a power of 2011 Using that high of a number doesnt boast any advantage over using, say, a power of 8 But honestly, I think you should consider a totally different way to encrypt. Try this as a basis for your next encryption ByteData As Byte() = System.Text.En

Categories : Vb.Net

Read String From Serial port Visual Basic
If you are having issues with extracting data from your serial port you could try this: Sub SerialPort_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Dim currentSP As SerialPort = Convert.ChangeType(sender, GetType(SerialPort)) Dim strBuilder As System.Text.StringBuilder = New System.Text.StringBuilder() For index = 1 To currentSP.BytesToRead strBui

Categories : Vb.Net

How to high light rows in list control in vb.net
You need to rewrite the code in FetchRowsStyle Event like below to highlight only some rows Dim val As String = Me.lstPats.Columns(2).CellText(e.Row).ToString If val <> "" Then e.CellStyle.BackColor = Color.Green End If

Categories : Vb.Net

How Can i know if a string is on MD5 format
option 1: Dim reg = New RegularExpressions.Regex("[0-9a-f]{32}", RegularExpressions.RegexOptions.Compiled) Function LooksMd5(str As String) As Boolean Return reg.IsMatch(str) End Function option2 (check and get bytes in one step - try parse string to bytes array) Function TryParseHex32(str As String, ByRef result As Byte()) As Boolean If str.Length <> 32 Then Return False Re

Categories : Vb.Net

activate windows application always
Read the post "How can I prevent other apps from stealing the focus?" Or try this if not there are more than controls in your form that txtCardID: Public Class Form1 Private fin As Boolean Private Sub Form1_Deactivate(sender As Object, e As System.EventArgs) Handles Me.Deactivate Do Me.Activate() My.Application.DoEvents() Loop Until fin End

Categories : Vb.Net

Select item from drop down list using text
try this: For Each Item In ComboBox1.Items If Item.ToString.Contains(TextBox1.Text) And TextBox1.Text.Trim <> "" Then ComboBox1.SelectedItem = Item ElseIf TextBox1.Text.Trim = "" Then ComboBox1.SelectedIndex = 0 End If Next you can modify this code, instead of using Contains function you can also use StartsWith or some string manipul

Categories : Vb.Net

Paste text into vb label on formload
You can use Clipboard.GetText(). Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load Label1.Text = Clipboard.GetText(System.Windows.Forms.TextDataFormat.Text) End Sub

Categories : Vb.Net

vb.net combobox hide item
You can use a DataTable as data source, then it's as easy as changing DefaultView.RowFilter, please study this example and let me know if you have any questions: Public Class Form1 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim dt As New DataTable dt.Columns.Add("id") dt.Rows.Add("1") dt.Rows.Add("

Categories : Vb.Net

Deleting record from query table composed of other table's columns(?)
try this change sqlQuery3 = "DELETE * FROM tblYouth_trips WHERE YouthID = cmb_youth_remove.selectedvalue.tostring AND TripID = cmb_trip_remove.selectedvalue.tostring" to sqlQuery3 = "DELETE * FROM tblYouth_trips WHERE YouthID = '" & cmb_youth_remove.selectedvalue.tostring & "' AND TripID = '" & cmb_trip_remove.selectedvalue.tostring &"'"

Categories : Vb.Net

Multithreading - Waiting for threads
Here is a simple example using TPL in C#. Declare an array to store the tasks then kick off each task with the Run() method. Pass the task array to the WaitAll() or you could use WaitAny() to handle each task as they complete. Task[] theTasks = new Task[7]; theTasks[0] = Task.Run( () => Console.WriteLine("Do Stuff")); Task.WaitAll(theTasks); A link to the TPL documentation. http://msdn.mic

Categories : Vb.Net

Vb.net checkbox won't load from text file
The issue is when you read/write the value false. There is a newline character after false in the output file, which is visible when you open the text file or initially read it into text. An easy solution to this is to simply use read.ReadToEnd().Trim() to remove the extra whitespace characters. You can also combine your nested If...Else into If...ElseIf...Else to make your code less confusing.

Categories : Vb.Net

Calculating the value with currency symbols
If you really don't want/cannot use built-in functions for currency or time formatting and if your data are always with the same format (i.e. currency symbol + value + per hour for this example, but anyway "forecastable"), then you could add to your project: A string -> number function to "clean" your value from the currency symbol and the "per hour" symbol, to hence return it in double type: Pu

Categories : Vb.Net

VB.NET Make Windows shortcuts to different forms in VB.NET program
You can catch the command lines with the StartUp Event found in the MyApplication Class Example: Private Sub MyApplication_Startup(sender As Object, e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup If e.CommandLine.Contains("-form2") Then 'Load Form2 ElseIf e.CommandLine.Contains("-form3") Then 'Load Form3 Els

Categories : Vb.Net

Visual Basic 2008, Random sting generator with custom length, how to make it?
Now your length is fixed - you run the loop For i As Int32 = 1000 To 3000 (i.e. 2001 times) and then add 3 symbols in each loop, which gives you 3 x 2001 = 6003 length. Easiest way would be to define the array of the symbols that are allowed and then combine random number of these: Dim random As New Random Dim password As New System.Text.StringBuilder Dim allowedSymbols as Integer() = {48, 49, .

Categories : Vb.Net

LINQ - SELECT certain columns
If your result no longer contains an Address, it's no longer a Person. The following does work: Dim test = From p In list Where p.Name = "Ian" Select New With { .Name = p.Name, .Age = p.Age } This creates a new, anonymous type which only contains the information you are interested in. The type of test is IEnumerable(Of SomeAnonymousTypeThatDoesNotHaveAName). In general

Categories : Vb.Net

linq any function vb.net
If your first bit of code is your intended behaviour then I think this suffices: Dim query = _ From sf In _SelectedFields _ From df In sf.DataFields _ From ag In _Aggregations _ Where Not ag.AggregatedExpr.Contains(df.FieldName) _ Where Not FieldInGroupBy.Contains(df.FieldName) _ Select df.FieldName For Each x in query MessageBox.Show( _ "Missing selected fiel

Categories : Vb.Net

Why am i not receiving serial data in visual studios but i am in putty?
You mentioned that you don't need to use handshake. I had a similar problem once and handshake did the trick. Try adding the following codes in your Sub Main() objSerial.ReadTimeout = 500 objSerial.Handshake = IO.Ports.Handshake.RequestToSend Also express edition is capable of reading serial data from ports. Also here is a tutorial that I found online, check it out and see if it helps: Reading

Categories : Vb.Net

Search a listbox, results will not highlight when searching results found
Your logic would only work if the last item was the match. For Each item As String In lstMain.SelectedItems If item.ToUpper.Substring(0, 24).Contains(strSearchField.ToUpper) Then lstMain.SelectedItem = item Exit For 'so the found item stays selected End If Next or For i As Integer = 0 To lstMain.Items.Count - 1 If lstMain.Items(i).ToUpper.Substring(0, 24).Contains(strSearchField

Categories : Vb.Net

NullReferenceException using StreamReader in vb
You have to initialize the array first. For example: Dim TownList(10) As TownType Then you have to initialize each TownList: Do Until reader.EndOfStream = True Line = reader.ReadLine Dim record = Line.Split(",") Dim tt As New TownType() tt.Name = record(0) ' .... ' TownList(Count) = tt ' .....' But since you don't know the final size of the array you should use a

Categories : Vb.Net

Program was started by user or scheduler?
I don't know what you are trying to achieve but wouldn't it be easiest to launch the application with some argument when running as a scheduled task? If you don't want to use argument you can base the detection on information about parent process. E.g. name of the parent process will be 'svchost' when running from scheduler. if(System.Diagnostics.Process.GetCurrentProcess().Parent().ProcessName

Categories : Vb.Net

Configuration system failed to initialize [After Login]
Alright so for some reason I messed around with the settings and enter Check | Boolean | User and it worked, anyway problem solved, but can someone tell me the reason why this happened? Thanks.

Categories : Vb.Net

Getting error that Conversion from String to Long is Not Valid in VB.net
The expressionIf No1 Or No2 Or No3 = No4 assumes that No1 and No2 are of type Boolean. You cannot apply the Or operator to something which is not boolean.

Categories : Vb.Net

How to save Visual Basic button change made during debug execution
Definitely you should learn about "My.Settings". Through Project Tab you open Project properties. Then in Settings tab you create an appropriate variable(for example Name = MyButtonText, Type = String, Scope = User, Value = snacks1). Making the assumption that you button is Named ButtonSnacks and you change its button.text from "snacks1" to "snacks2" through another button's(ButtonChange) Butt

Categories : Vb.Net

Splitting a string into different data types
You can split it into a String(), then use Int32.Parse to parse the last two into integers. Dim tokens = text.Split(","c) Dim part1 As String = tokens(0).Trim() Dim part2 As String = tokens(1).Trim() Dim part3 As Int32 = Int32.Parse(tokens(2).Trim()) Dim part4 As Int32 = Int32.Parse(tokens(3).Trim()) If you don't know if the format is valid you can use this super-safe version: Dim part1 As

Categories : Vb.Net

For Loop inside Caesar Cipher VB.Net
You need to use Lbound() and Ubound() to navigate arrays. Also, I do not see i reserved anywhere. You also should have the function return the value through the function itself For i = Lbound(LetterArray) to Ubound(LetterArray)-1 EncMessage = ...your cipher thing here Next Encrypt = EncMessage

Categories : Vb.Net

Argument issue when using vb.net shell ()
You hace a folder in the command with a space in it (probably the documents and Settings folder). cmd.exe has no way of telling whether the space is in the file name or the end of the file name, unless you put the file name in "" - like "C:doxuments and Settings..." Dim command As String = tempPath & "app.exe -f "" & IO.Path.GetTempPath & "" -o "" & save & "" & pause"

Categories : Vb.Net

Adding records to a csv file
File operations are fast. Do not use any stream at class level. Open, add, close. File.AppendText Using sw As StreamWriter = File.AppendText({path}) sw.WriteLine({record}) End Using

Categories : Vb.Net

Implementation PubNub for VB.Net
PubNub VB.Net Quick Start You might consider using PubNub Simple HTTP REST API and here are a few links for using Visual Basic .NET with PubNub. Since we don't have an official VB.NET API you can find really easy to use options. HTTP Streaming over TCP with Telnet Example PubNub HTTP REST API

Categories : Vb.Net

When I change a value in one list of collection , another list that is a copy of first list, also changed
msdn.microsoft.com/en-us/library/21k0e39c%28v=vs.110%29.aspx The elements of s2 still point to the same underlying objects (it is a shallow copy). I.e. s2 contains references to the same block object instances as the elements 0, 1 and 2 of s1 To make complete copies of your object depends on what your Block class is/does. You may find http://msdn.microsoft.com/en-us/library/t63sy5hs.aspx basic

Categories : Vb.Net

Appending a csv file
OpenMode.Random is used for reading/writing files that have a fixed width record. It is unclear from your post if you actually have fixed width records (my hunch is you don't). At any rate, to properly read/write in random mode you'd have to declare a structure that defines the length of each record and also tell the system the length of the record when you open it (so that it can move that many

Categories : Vb.Net

Options disappeared from the project's application properties on Visual Studio
Chek Application.myapp file within "My Project" folder of your application. Usually it is caused by invalid xml tags. Often git merge conflict causes this file to be invalid. Just open and resolve the conflict and restart the visual studio.

Categories : Vb.Net

Using Polymorphism with incompatible signatures
Your person objects are instances of Types which just happen to inherit from some the same type. As an instance of Person1, the P1 object is not going to have any knowledge of methods contained in Person2 because it is a different Type. I am not quite sure what you are after, but here is one way to construct it: Public MustInherit Class Person Public Property Name As String Public Sub

Categories : Vb.Net

Reading and writing from a csv file
This will read the contents into a collection and you can get the number of records from the collection. Sub Main() Dim FileName As String Dim NumberOfRecords As Integer FileName = "N:2_7_towns(2).csv" 'read the lines into an array Dim lines As String() = System.IO.File.ReadAllLines(FileName) 'read the array into a collection of town types 'this could also be do

Categories : Vb.Net

Setting the value of a constant or variable at build time
You could try this (tested it and worked for me) Public NotInheritable Class ApplicationInformation Private Sub New() End Sub ''' <summary> ''' Gets the executing assembly. ''' </summary> ''' <value>The executing assembly.</value> Public Shared ReadOnly Property ExecutingAssembly() As System.Reflection.Assembly Get Return If(

Categories : Vb.Net

VB.NET treeview error add second child nodes
hmm, You seem to get duplicate Keys. Try this: If mROC("parentCode").Value = "" Then srcTv.Nodes.Add(mROC("code").Value & "A", tmpStr) Else Dim TNode() As TreeNode = srcTv.Nodes.Find(mROC("parentCode").Value & "A", True) Dim sKey As String = mROC("code").Value If srcTv.Nodes.Find(sKey & "A", True) Is Nothing Then

Categories : Vb.Net

Visual Studio - Visual Basic - Protected Memory Error?
Try creating a new project, then copy and paste code from the old project. You may or may not have to recreate the forms in the designer. Also, make sure you have System, System.Core, System.Drawing, and System.Windows.Forms included as references for the project.

Categories : Vb.Net

Arguments Not specified for parameter in private sub
here is the solution where you just need to remove the arguments from the method. Your Search_Click method will remain same. Private Sub InsertTempFile() Dim FromDate As Date = FromDateDateTimePicker.Value Dim ToDate As Date = ToDateDateTimePicker.Value Modws.UpdateItem("Insert into RptTempTable(RECEIPTTOTAL) select Debtor,Sum(Matching.Amt) from Matching left join receipt on rec

Categories : Vb.Net


Recently Add
Using Dynamic Linq to set column name
Set Crystal Reports Jet database password programmatically
resize control.size width designer in vb.net winform ,but this action affected other control size
Overflow Exceptions was unhandled
Read String From Serial port Visual Basic
How to high light rows in list control in vb.net
How Can i know if a string is on MD5 format
activate windows application always
Select item from drop down list using text
Paste text into vb label on formload
vb.net combobox hide item
Deleting record from query table composed of other table's columns(?)
Multithreading - Waiting for threads
Vb.net checkbox won't load from text file
Calculating the value with currency symbols
VB.NET Make Windows shortcuts to different forms in VB.NET program
Visual Basic 2008, Random sting generator with custom length, how to make it?
LINQ - SELECT certain columns
linq any function vb.net
Why am i not receiving serial data in visual studios but i am in putty?
Search a listbox, results will not highlight when searching results found
NullReferenceException using StreamReader in vb
Program was started by user or scheduler?
Configuration system failed to initialize [After Login]
Getting error that Conversion from String to Long is Not Valid in VB.net
How to save Visual Basic button change made during debug execution
Splitting a string into different data types
For Loop inside Caesar Cipher VB.Net
Argument issue when using vb.net shell ()
Adding records to a csv file
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.