vb.net

Serial port project form close not responding

谁都会走 提交于 2021-01-29 22:42:16
问题 I want to make serial port based project i have code like this .when i try to close my form it become not responding and hang my app please give suggestion and correct my mistakes in my code thank you in advance Imports System Imports System.ComponentModel Imports System.Threading Imports System.IO.Ports Public Class frmMain Dim bw As BackgroundWorker Dim myPort As Array 'COM Ports detected on the system will be stored here Delegate Sub SetTextCallback(ByVal [text] As String) 'Added to

Best practices on load a form inside a main form, both residing in an external DLL assembly

倖福魔咒の 提交于 2021-01-29 22:41:09
问题 I've loaded an external DLL into your project like this Dim assembly As Assembly = Assembly.LoadFile(libraryPath & "filename.dll") Dim type As Type = assembly.[GetType]("NameSpace.ClassName") // i'm loading as a form here but can be any control Dim frm As Form = TryCast(Activator.CreateInstance(type), Form) What are the best practices if you're loading a class or a control inside the loaded form (above) that resides also inside the same assembly ? for instance: Lets say you loaded an assembly

My RightToLeft DataGridView display numbers in Arabic

我们两清 提交于 2021-01-29 20:39:39
问题 I have a DataGridView in Windows Form Application When I set DataGridView1.RightToLeft = RightToLeft.No the numbers in this DataGridView are displayed in English like this '12345', but When I set it to RightToLeft.Yes the same numbers are displayed in Arabic like this '١٢٣٤٥' and I don't want this, I want numbers always in English I think this is because my windows language is Arabic so I tried to change Current Culture, but this didn't help and the numbers are still in Arabic Thread

QuickBooks Online Api Error “The remote server returned an error: (400) Bad Request”

陌路散爱 提交于 2021-01-29 20:31:17
问题 I'm using the QBO API and am at the step where I'm trying to retrieve the access and refresh tokens. When I send my request I get an error when I try to get the response that states "The remote server returned an error: (400) Bad Request". See the code below. I've tried a number of variations in my header, but cannot get it to work. Any ideas? Code (using vb.net): Sub Step2_GetTokens() 'Delcare variables. Dim vHTTPREQUEST As HttpWebRequest Dim vHTTPRESPONSE As HttpWebResponse Dim

Parent/Child ComboBoxes

若如初见. 提交于 2021-01-29 20:30:42
问题 I have 2 combobox, each having different items but somehow it's a hierarchy of characteristics of the next combobox ie: Combobox1 has VEHICLES, MOTORBIKES and NONE as items. I want to be able to choose Vehicles in combobox1 and Combobox2 updates with items only associated with vehicles ie Sportscar, Sedan etc. The same should happen when I choose Motorcycles in combobox1, it should update combobox2 with items only related to motorcycles. 回答1: Put this sample code inside the ComboBox1

SQL DataReader giving “string or binary data will be truncated”

痴心易碎 提交于 2021-01-29 19:06:42
问题 I'm trying to read a table where under normal circumstances zero rows will be returned. If any rows are returned an error message is shown. I've tested the SQL statement in on SQL Server and it works. However, I'm getting an error in the DataReader. My code is as follows: Using sqlConn As SqlConnection = New SqlConnection(cSettings.PrimaryConnectionString) Dim sSQLc As String = "SELECT * FROM UnitHistory " _ + "WHERE Unit=" + iUnitID.ToString + " " _ + "AND StartDate<='" + returnSQLDateString

vb .net access json information

坚强是说给别人听的谎言 提交于 2021-01-29 18:54:27
问题 I have the following json output: { "id":"354asda-asd435544-35438738fd", "oid":"354asda-asd435544-35438738fd-asdasd1212", "mids":[ 476252 ], "name":"This is my name", "language":"en", "released":"2020-01-24", "url":"https://myownurl", "url2":"https://myownurl2", "image":true, "image_url":{ "small":"https://myownurl/img_sm.jpg", "large":"https://myownurl/img_lg.jpg", "png":"https://myownurl/img_sm.png", }, ... } I'm trying to access this information, but getting some trouble with it, with the

How to view entire call stack hierarchy without breakpoints? (Visual Studio 2015 + ASP.NET Web Forms)

戏子无情 提交于 2021-01-29 18:52:00
问题 I want to figure out what methods are being called in what order when I build and run an ASP.NET web form application. The context is that I'm trying to decipher the architecture of the code base I'm working on, and its not clear where the program begins. Using breakpoints randomly has been helpful but does not give the entire picture. Is something like this possible? 回答1: You can use my Runtime Flow extension to view entire method calls hierarchy of an ASP.NET applicaton. 来源: https:/

Retrieving “Number” From Sql VB.NET System.Data.OleDb.OleDbException: 'Data type mismatch in criteria expression.'

♀尐吖头ヾ 提交于 2021-01-29 18:36:26
问题 If I want to retrieve a value that is saved as a number in an access database. Im using the following: Dim sql As String = "SELECT ArithmeticScore FROM " & tablename & " WHERE DateAscending = '" & todaysdate & "'" Using connection As New OleDbConnection(getconn) Using command As New OleDbCommand(sql, connection) connection.Open() scorevalue = CDec(command.ExecuteScalar()) 'Data type mismatch in criteria expression. connection.Close() End Using End Using MsgBox(scorevalue) getconn = connection

disabling a button on form 2 from form 1 with a checkbox

僤鯓⒐⒋嵵緔 提交于 2021-01-29 18:06:23
问题 I have two form objects: form1 and form2 . I have 1 button on form2 and a check box on form1 . When the check box is checked, I want to show the button and when it is unchecked I want the button to be disabled. I know that in visual basic I did such a thing like this: form2.button.visible = false How would I do something like this in c# ? 回答1: In general case (when Form1 and From2 instances are independent) you can do something like that. In Form2 implement a public property : public partial