Problems adding a COM component reference to a VB.NET project

I have a third party COM dll that I'm trying to add to a vb.net (2008 express) project. I put the dll in C:\WINDOWS\system32\ and registered it with "regsvr32 vxncom.dll". When I go to projects > add reference and go to the COM tab it shows up in the list of available components/libraries. But, when I select the library and hit ok, visual studio complains: "A reference to 'vxncom 4.0 Library' could not be added. Could not register the ActiveX type library 'C:\WINDOWS\system32\vxncom.dll'." The

Is it possible to override a property and return a derived type in VB.NET?

Consider the following classes representing an Ordering system: Public Class OrderBase Public MustOverride Property OrderItem as OrderItemBase End Class Public Class OrderItemBase End Class Now, suppose we want to extend these classes to a more specific set of order classes, keeping the aggregate nature of OrderBase: Public Class WebOrder Inherits OrderBase Public Overrides Property OrderItem as WebOrderItem End Property End Class Public Class WebOrderItem Inh

Vb.net SQL proc executes but nothing is inserted into the table

I have a vb.net app using plain old ado.net to run a s'proc on the database server. The proc simply inserts a record that contains binary data. When this executes, I can see the exec call on the proc being made from within sql profiler. ado.net claims everything worked, no errors. However, a record isn't inserted. There are no key collisions or anything like that. I copied the query I saw from profiler and ran it directly within management studio. When I run it there, the record is insert

GridViewHelper is not recognised in VS 2010 when I use VB.Net

I have a gridview and I'd like to summarise data in it and I found some code to help me do that on the following website: http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm. The thing is, when I tried to convert and use it in my program, GridViewHelper just refused to be recognised and so, now I'm stuck. Please let me know the right procedure to implement the same in VB. Thanks!

Vb.net compiling assembly from the other just compiled assembly

I need to compile assembly in memory, that can compile another one. There is a form with one button. Here is a code of the form Imports System Imports System.Threading Imports System.CodeDom Imports System.CodeDom.Compiler Imports System.Collections Imports System.ComponentModel Imports System.Diagnostics Imports System.Drawing Imports System.IO Imports System.Windows.Forms Imports Microsoft.VisualBasic Public Class testtwo Shared str_tb As String Private Sub Button1_Click(ByVal sender

convert vb.net data to json string and send it to a specific URL

this is the JSON string the data is required in to be sent using a given URL. $jsonstr = '{"data": [{ "id":"5", "owner_id":"0", "status":"unassigned", "first_name":"Test", "last_name":"IS", "tobacco_user":"", "date_of_birth":"", "age":"", "gender":"", "email":"lb@you.com", "zip":"", "phone":"(210)629-2560", "phone_type":"cell", "phone_alt":"", "phone_alt_type":"", "product_msip":"", "produ

Vb.net append a DWORDs Decimal value apposed to Hexadecimal

I need to write a new value to the registry. I have come stuck at the following code because what i can add is a standard key and i need to place a new decimal value to a DWORD key (aposed to a hexadecimal value) {Dim wsh wsh = CreateObject("WScript.shell") wsh.regwrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\NoDrives\dword", "789")}

Vb.net Help assigning Gridview check box to a variable

This line of code references a checkbox in a Gridview, how can I assign the value of the check box 1 or -1, I think it is for checked or unchecked, to a variable so that I can run an if statement against it, and change it to True or False? dt.Rows(row.DataItemIndex)("DisplayString") = (CType((row.Cells(3).Controls(0)), CheckBox)).Checked

Vb.net How to Convert a character array to string array

I have the code below that requires me to convert a character array to string array, but I get the following error: Option Strict On disallows implicit conversions from '1-dimensional array of Char' to 'System.Collections.Generic.IEnumerable(Of String)' Dim lst As New List(Of String) lst.AddRange(IO.Path.GetInvalidPathChars()) lst.AddRange(IO.Path.GetInvalidFileNameChars()) lst.Add("&") lst.Add("-") lst.Add(" ") Dim sbNewName As New StringBuilder(orignalName)

Vb.net How to log in to a web page through code

I need to make a super simple web-page monitoring tool in VB.Net that checks FieldNation.com every few minutes for new work orders. To do that, I need to log in to their page. I think I can figure out how to read the page once I'm logged in, but how can I actually log in? I heard it had something to do with WebClient. Thanks! -Wyko

Vb.net Multiple If Else statements and how to control them

In my web application I have defined a Regex, Match and str. So the Regex will be used to compare other strings with str and the Match to identify any matches found in the textboxes. In my code I have 3 strings defined as matches to be compared with str. A connection to the database is also defined. The following code shows the definitions: Dim r As Regex = New Regex(str2, RegexOptions.IgnoreCase) Dim m1 As Match = r.Match(txt1.Text.ToString) Dim m2 As Match = r.Match(txt2.Text.ToSt

Vb.net Method for replacing INVOKE

Is there a way around using the Invoke and InvokeRequired methods for objects which were created in other threads? Is there a method which is more direct and less memory intensive? Perhaps a state machine or thread controls? Am I wasting my time worrying about this method's resource usage? I'm using this invoke method: http://tech.xster.net/tips/invoke-ui-changes-across-threads-on-vb-net/ I'm using VB.NET in VS 2012

Vb.net Dark Transparent Layer on Inactive Form

Like Some Webpages, I need one feature in My VB.NET WinForm Application. While A Child Form is Active the Parent Form in the Background should have transparent dark layer on It, So that User Can easily focus on Active Form. If Parent form Itself got activated, that dark layer should not appear. Initial Idea was to use Panel Control but Unfortunately It doesnt have Opacity Property.

Vb.net Slow get data from data gridview into SQL Server

I have 50000 records to display on datagridview then I want save it to database, but it is very slow when inserting into SQL Server. My code: For x As Integer = 0 To Me.DataGridView1.Rows.Count - 1 With DataGridView1 Insert into tbl1 values("&.Rows(x).Cells(0).Value&", ......) End With Next Do you have any solutions?

Vb.net Exception in assigning to CurrencyDecimalDigits in Globalization.NumberFormatInfo

I'm using Globalization.NumberFormatInfo in vb code and trying to assign value to CurrencyDecimalDigits which is a member of this class: Dim a As Globalization.NumberFormatInfo a = New Globalization.NumberFormatInfo() Dim b As Integer = 4 a.CurrencyDecimalDigits = b In MSDN it's written that it is a read only member, though it is shown a code with assigning to it: http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.currencydecimaldigits.aspx Is there a way

Vb.net How do I retain database connectivity, with my project, when the source file path changes?

I am using a Microsoft Access Database in my project; saved to the bin folder. What can I do, to ensure connectivity to that database, when the file path changes? Imports System.Data.OleDb Public Class Form3 Dim con As New OleDb.OleDbConnection Dim da As OleDbDataAdapter Dim ds As New DataSet Dim str1 As String con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\AARVIII\Documents\DATABASE\MP1.accdb"

Vb.net Listbox in dynamic web user controls lost data after postback

I create dynamic web user control which has a list box and a textbox. However, data in the list box is lost after postback but the data in the textbox isn't. I've read a lot of forums and pages about web user controls and I understands that web user controls recreate after such post-back. Could you please show me the way to get data of list box before post back ? Thank alot '-------------------------------------- Note that: my web user control has a list and text boxes, user can add value

Vb.net How to make a button do two things after the other

I'm a new programmer starting out in visual basic and I am trying to make a visual novel, but I have run into a few problems. I am trying to make the text change to the next line of text when a button is pressed. Here is some example code I am using. The 'DisplayText' is where the speech is contained and 'ButtonNext' is the button to go to the next piece of text. Private Sub ButtonNext_Click(sender As Object, e As EventArgs) Handles ButtonNext.Click If DisplayText.Text = "" Then Di

Vb.net get the port on localhost on which service is running

i have a service on my computer (personal computer and app is third party). Everytime i start it it runs on a localhost port like : localhost:13133 Now 1 want this port number on which service is running. Is there any command or code i can use or read some file where it is stored everytime a service is started? I cannot put a fixed number in my code and want to read this everytime it changes or is run. Please help? Regards,

Vb.net Can I have notify icon for my external program called by shell?

I'm developing one exe program (A) that have link to call another exe(B). But then, I have an issue to set up notify icon for exe (B). Here codes to call exe(B): Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Shell("C:\\programB.exe", AppWinStyle.NormalFocus) End Sub How do I put the notify icon to exe(B)?

vb.net System.Drawing

How can I load picture from file, and show it over graphics which is drawn on the form? For example, I have green rectangle across Windows form, and I want to put picture of a dog over that green area, picture from the file, I don't want to draw it using vb.net code. I tried this with PictureBox control, but picture doesn't show.

Vb.net Visual studio 2013 builds every time unnecessarily and is slow

I have Visual Studio profession 2013. .NET framework installed 4.5. My Visual studio is giving me some problems. When i run it builds every single time.Takes up a good 2 minutes to build. If i change a class then i understand it should build, but not every time i make a change to .aspx or .aspx.vb page. it did not work this way for Visual studio 2012. Is there any setting I am not seeing?Language being built in is VB. Should i change any setting value? Is there any IIS express value I need to

Vb.net Collection modified exception thrown when the collection wasn't modified

I'm getting an exception which I don't understand in this bit of code here: Dim folderList As List(Of String) = _folderList For Each folder In folderList destinationFolder = destinationFolder + "/" + folderName localFilePath = lbl_folderPath.Text + "/" + folder alterFolderList(localFilePath) ... Next I've got a global variable _folderList which I copy to another variable, folderList, as seen in the first line of my code. When the last method (alterFolderList) is called, i

Vb.net Retrieve errors from MySQLDataAdapter.update()

I'm deliberately trying to change my dataset to have a duplicate primary key with the expectation that this action would throw a mysql error. How can I retrieve such errors from MySQLDataAdapter.Update()?? I've had a brief look at event handlers but I can't seem to find where to get the error anywhere. Although I did notice that MySqlRowUpdatingEventArgs.Status = SkipCurrentRow Code snippet: Private Sub UpdateTable() Dim MyCommandBuilder As New MySqlCommandBuilder(MyDataadapter) txtC

Vb.net Is it possible for modules to share code

I am looking at Module A which performs task I am also looking at another module (module B) which performs task Tasks A & B are to all intents and purposes similar but for one small difference. If they were classes I would be inclined to re-factor them such that the common code ended up in a base class inherited by modules A and B (which would of course now be classes because you cant inherit in a module). However keeping Modules A & B as modules happens to be preferable in this pa

Vb.net ComboBox SelectChangeCommited fires off with first keyboard input

I have a ComboBox. My issue is when I click on element 1, then start typing the name of a element 2, the first letter of my element 2 gets added. This only happens on the key down after a click event. Process: Click on ComboBox Type in a name Click on the elements name - element gets added to my grid Type in another name - ISSUE - first element that matches the first letter I input gets added to the grid Clicking and the enter key on a single selected element works fine. My AutoComplet

Aspose VB.NET Bar Chart Value

I am setting up a bar chart that will end up exported into a PowerPoint slide. I've got it exporting perfectly fine but it has been requested that at the top of each bar the value of that bar is placed right above it. I've looked high and low and unfortunately haven't been able to find out how to do so.

VB.NET UserControl does not receive parent form's events

I have created a usercontrol and added it to a form. I would like to receive the form's event using Private WithEvents _Parent As Form. But none of the events is being received. The entire code of my usercontrol is attached. Does anybody see what I am doing wrong? Public Class UserControl1 Private WithEvents _Parent As Form Public Sub New() InitializeComponent() _Parent = Me.Parent End Sub Private Sub _Parent_Activated(sender As Object, e As EventArgs) Handles _Parent.Activated

Vb.net Can't clear a DataGridView combobox without 100s of errors

I'm using VB.NET to make a stand-alone executable containing an unbounded DataGridView. One of its columns is a combobox. I add rows to the combobox with some simple code like this: For r As Int16 = 0 To eachLine.GetUpperBound(0) Dim dgvcbc As DataGridViewComboBoxColumn = grd.Columns(col) ' Errors: dgvcbc.Items.Clear() dgvcbc.Items.Add(eachLine(r)) Next r Works great the first time, but when I try to clear it, in order to add some different items in the combobox, I get t

Decimal separator lost after export from VB.Net to Excel

I have numbers and text stored in a 1-dimensional string array which i need to send to excel. For this operation i used a simple code: WPFtoExcel.Range("A1").Activate() For item = 0 To 10 WPFtoExcel.ActiveCell.Value = Array(item) WPFtoExcel.ActiveCell.Offset(0, 1).Activate() Next Some numbers that have >2 decimals in the array loose their decimal points during the transfer: 5,65 appears in excel as 5,65 {OK} 0,0152 appears in excel as 0,0152 {OK} but: 800,111 appea

Vb.net Save into app.config appSettings value

I have following app.config. I would like save into ConnectionString key value - my text from serialized xml. Private Shared strcon As String = New AppSettingsReader().GetValue("ConnectionString", GetType(System.String)).ToString() <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="ConnectionString" value=""/> </appSettings> <system.diagnostics> <sources> ... So far i

Vb.net Checking if object has custom attribute

I've got a recursive deep-copy function to create new instances of objects. To improve my function's capabilities I want to put some kind of <noCopy> custom attribute on some values within my object to prevent them from beeing copied an object to be copied may look like this: public Class CDatabase public var1 as double private var2 as CSomeObject <noCopy> private var3 as double <noCopy> private var4 as CSomeObject ... end class my recursive function loo

Vb.net Allow form to be edited once user clicks edit button

I'm coding in Visual Basic. I have a file in Access that I am using as my Data Source. I have the form I am creating that is completely Read Only, so the user will not be able to edit any of the information. My question is, I have created a button also on the form that I would like to put the form into edit mode when the user clicks the button, so the user will be able to make changes. How would i go about doing that?

Vb.net Getting HttpWebRequest POST error

I don't know what is wrong since this code works amazing for me every time, but for an single website it give me an error called NullReferenceException was undhandled at mainCookie.Add(postResponse.Cookies) line. Here is the code: Dim mainCookie As CookieContainer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim postData As String = "login=login&username=" & UserText.Text & "&password=" & PassText.Text & "&login=Login" D

Vb.net Error: Open Files From my project

i need to make program which can the user select his file path from his computer and then click on start button to OPen... and when he close the program and return open it again. can Direct open his program that he select without click on select file path again... but i get thes error Error1 error2 My Codes:.. Select Button If OpenFileDialog1.ShowDialog = DialogResult.OK Then TextBox1.Text = OpenFileDialog1.FileName End If Open Button: System.Diagnostics.Process.Start(O

Vb.net How to use urldecode in Htmldocument

I have got the HtmlDocument of this url www.vipme.com/clothing_c900027 since their website include the encoded characters here is my code Dim myHtmlDom As HtmlDocument = GetHtmlDocument(requestUrl, item.cookie, "refer", item.pageEncoding) Dim myProdDom As HtmlNodeCollection = myHtmlDom.DocumentNode.SelectNodes(item.prodPath) For Each inode As HtmlNode In myProdDom Dim newProd As New Product() If (String.IsNullOrEmpty(item.urlPath)) Then newProd.Url

Vb.net Variable inaccessible due to protection level

I am writing a VB.Net Private Function generateXMLSchema() Dim generatedXmlSchema As String = "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global"><soapenv:Header/>" & _ "<soapenv:Body>" & _ "<glob:RouteBundleMaintainRequest_sync_V1>" & _ "<Route actionCode="01">" & _ "<Name>tEST 250502</Name>" & _

Vb.net Error when uploading file to FTP server using My.Computer.Network.UploadFile

I am using this code to upload / download files from my FTP server //Download My.Computer.Network.DownloadFile(txtFile, localFilePath, userName, pw) //Upload My.Computer.Network.UploadFile(localFilePath, txtFile, userName, pw) The download is working perfectly. The upload line throws a WebException though. This is kind of weird since I'm using the same variables in both requests. Any idea what the reason for this could be? Thanks

Vb.net Visual Studio 2015 -Release Folder

I want the related files to the project to be saved to release folder everytime the project is run.I want the files to overwrite the files if they already exist in release folder when I run tha project. I know there is a window pane that has this option.I am not able to recall. Has anyone any idea about this? Please help!

Network Discovery Checking using VB.NET

Good day people! I just want to ask if there's a way to check if the Network Discovery button in windows os if it's on/off using VB.NET. I manage to find a code using cmd but it only enables me to turn it on/off but what i need is to check if it's on/off. Any ideas? Thanks!

Update function not working in vb.net

currently I'm develop a system using VB.NET. I have the following query for UPDATE. This query is work when I run in SQL Developer UPDATE CCS2_TBL_INSPECTION_STANDARD SET CCSEQREVITEM = :CCSEQREVITEM, CCSREVEFFECTIVEDATE = TO_DATE(:CCSREVEFFECTIVEDATE,'DD/MM/YYYY') WHERE CCSEQID = :CCSEQID But when I try applied this query in VB.net, its not work. Actually the flow for this update function is work but when I update the data, it is not working. For example, I want update name from 'Ali' to

Vb.net Microsoft.Office.Interop.Word.Shapes.AddPicture Proportional Image Manipulation

Is there a way to add a picture that is proportionally constrained to a certain area? I'm having to modify a program I wrote years ago, and the customer is supplying me with image sizes that are all over the place! Worse, it seems like us manipulating the image on it's own. I don't see anything in the docs that stand out for this, so here I am! I realize that there are .Height and .Width object parameters, but given the current supply of images, I am hoping to avoid writing code that works t

Vb.net datagridview 2 table wrong output

Given the following code: connection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=consignacion.mdb;") SQLStr = "Select buyer,balance, (SELECT SUM(salesdb.total) From salesdb Where salesdb.buyer = buyerdb.buyer and buydate=@buydate and salesdb.total is not Null and salesdb.total<>@sales ) As [paid] From buyerdb where balance>@balance" cmd = New OleDbCommand(SQLStr, connec

Vb.net How to (auto-)update a column in a table using a count query

I am making an attendance management system in which there is a database with the table of all marked attendances and i want to count all the records to put them in another table known as Accounts I have tried running update queries to set the 'Present Count' values using a sub-query PCount that sorts the records out according to the usernames I have ran Query1 but it won't change the records in Present Count according to CountOfUsername e.g Present Count for User2 should = 3. PCount: S

Vb.net Error logging in at FormLogin, Visual Studio

I get an error like this , where when I fill in the username and password, about an error found like this, I'm confused, which part is wrong. Additional information: ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.5.5-10.1.38-MariaDB]You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'admin‘and tipe='Admin‘' at line 1 And this my full code Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles

Vb.net How to access properties and multiple values in an awaited object?

I have a class which contains some properties I need to access the values of in another file. Public Class ReturnValues Public Property result As String Public Property resultBank As String Public Property resultAddressMatch As String End Class I call my async function and also create a new instance of my object Dim results As ReturnValues = New ReturnValues() Public Shared Async Function x(ByVal sUserID As String) As Threading.Tasks.Task(Of Object) It goes ahead and makes a call

  1    2   3   4   5   6  ... 下一页 最后一页 共 286 页