|
Nope. You have to define exactly what you mean by "calculate chord in midi".
And VB6 has long been dead. You have absolutely no reason for using on on new projects. The Community edition of Visual Studio is free from here[^]. It supports VB.NET, C#, C/C++, ...
|
|
|
|
|
|
Hello all.
I am using the FMOD libraries to perform a spectrum analyzer, the results of the call to the library store in the array 'Spectrum ()' type 'Single', later these are passed to the array 'InSpect ()' type 'Integer '
The problem I have in the conversion of 'Single to Integer' gives overflow error, once I examine the data in the array 'InSpect ()' I have nothing are empty, while in the array 'Spectrum ()' are all the data, I have not yet found such an error or failure.
Let's see if you can help me, Thanks.
The code is following (summarized):
Dim Spectrum(1023) As Single
Dim InSpect(1023) As Integer
Dim i as Long
Dim DetSpectro As Long
Call FMOD_System_GetSpectrum(system, Spectrum(0), 512, count, FMOD_DSP_FFT_WINDOW_TRIANGLE)
DetSpectro = system
CopyMemory = Spectrum(0), ByVal DetSpectro , 1024 * 4
For i = 1 To 1023 Step 1
InSpect(i) = Spectrum(i)
Next
THX.
|
|
|
|
|
That means the Single value represents a number that is larger than the largest Integer value. You may need to use the Long type instead.
|
|
|
|
|
Hello,
But the conversion would have to do it automatically when I declare the array type Integer.
THX
|
|
|
|
|
That is irrelevant. If the floating point number represents a value greater than 2147483647, then you will get an overflow error. you need to inspect your data values to see why it is happening; we cannot do that.
|
|
|
|
|
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
dataFile = "C:\Users\achikanya\Desktop\xray database.accdb"
connString = provider & dataFile
myConnection.ConnectionString = connString
myConnection.Open()
Dim str As String
str = "Insert into Patient Details([National ID],[First Name],[Last Name],[Phone number],[Email],[Procedure],[Gender],[Address],[Date]) Values (?????????))"
Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
cmd.Parameters.Add(New OleDbParameter("National ID", CType(TextBox1.Text, String)))
cmd.Parameters.Add(New OleDbParameter("First Name", CType(TextBox2.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Last Name", CType(TextBox3.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Phone number", CType(TextBox4.Text, String)))
cmd.Parameters.Add(New OleDbParameter("(Email", CType(TextBox5.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Procedure", CType(TextBox6.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Gender", CType(TextBox7.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Address", CType(TextBox8.Text, String)))
cmd.Parameters.Add(New OleDbParameter("Date", CType(TextBox9.Text, String)))
|
|
|
|
|
You're missing commas between the parameter placeholders, and you've got an extra closing bracket at the end of the statement:
str = "Insert into Patient Details([National ID],[First Name],[Last Name],[Phone number],[Email],[Procedure],[Gender],[Address],[Date]) Values (?, ?, ?, ?, ?, ?, ?, ?, ?)"
There's also no need to CType the Text properties as String , since they're already String s.
cmd.Parameters.Add(New OleDbParameter("National ID", TextBox1.Text))
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In addition to Richard D's comments, you have an open parenthesis character before "Email" in the following:
cmd.Parameters.Add(New OleDbParameter("(Email", CType(TextBox5.Text, String)))
|
|
|
|
|
hola buenas tardes:
espero puedan ayudarme con la siguiente duda, tengo conexion a un lector de huella iface 302
el cual necesito extraer (al momento de checar, el id y nombre del usuario )
alguna sugerencia
esto en el evento onattransction.
Dim enrollnumber As String
If CZKEM1.ReadAllUserID(CInt(MachineNumber)) Then
GetUserTmpExStr MachineNumber, dwenrollnumber, dwFingerIndex, iFlag, tmpData, tmpLength
dwEnrollNumber1 = dwEnrollNmber
dwEnrollNumber1 = EnrollNmber
'Wend
End If
Text4.Text = UserID
Text1.Text = EnrollNmber
Else
'MsgBox "Verify Fail"
End If
no logro ..ayuda.
|
|
|
|
|
|
using vb.net windows form to create custom error message box
modified 9-Oct-18 10:41am.
|
|
|
|
|
What is your user interface web, winforms, WPF. They are all very different.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I did this once with an array in the tag. on the form activate I read the array and returned on the click the dialog result
another way is create propertys
Private _buttonPushed As Integer
Private _buttonarray(,) As Integer
Public WriteOnly Property buttons(buttonarray(,) As String)
Set(value)
buttonarray = buttonarray
End Set
End Property
Public ReadOnly Property Result() As Integer
Get
Return _buttonPushed
End Get
End Property
ButtonArray contains in this case Texts and values
|
|
|
|
|
Hi all,
I am a very beginner in programming, myself learned something out of curiosity from internet.
After more than a year work, I had developed a program in vb 2010 express for the data entry of my patients details in my clinic. Now I need to do something to add the contact details of patient to my google contacts. Currently I am saving the details to an excel sheet and importing it to google manually. After searching in the internet, I had read it needs API and its not free to use also. I had never worked with API and is thinking of a free option. Any one can help me in this matter? Thanks in advance.
|
|
|
|
|
|
Thanks for the reply. Will check it out.
|
|
|
|
|
Could someone tell me how to create a random access file in visual basic.net? I know how to do it in vb6 but I think it is different in vb.net Any help would be appreciated.
Jeff
|
|
|
|
|
|
Sorry again guys,
After working for an hour or so I finally figured out that GetString() is also
including the terminating Null char (0) in the string so
sReturn = System.Text.Encoding.UTF8.GetString(buf, 0, buf.length-1)
works.
I have code that uses System.Text.Encoding to convert a byte() to string.
I use Marshal.Copy(lpEntryBuffer, buf, 0, Len) to copy lpEntryBuffer to buf.
I have created test code below that shows what is being copied into buf above
getting the same result.
' buf Text = "1, 0, 0, 1"
Dim buf() As Byte = {49, 44, 32, 48, 44, 32, 48, 44, 32, 49, 0}
Dim sReturn as String = System.Text.Encoding.UTF8.GetString(buf)
' This test is False, not equal
If sReturn = "1, 0, 0, 1" Then
sReturn = ""
End If
The value of sReturn in stack trace looks like this:
"1, 0, 0, 1
without the end double quote which seems like a string termination problem.
Can someone help me?
Thank you
-- modified 3-Oct-18 18:37pm.
|
|
|
|
|
--edit
Didn't see the "already solved" part
From the code you shown;
Sub Main()
Const DEFAULTTEXT As String = "1, 0, 0, 1"
Dim buf() As Byte = {49, 44, 32, 48, 44, 32, 48, 44, 32, 49, 0}
Dim sReturn As String = System.Text.Encoding.UTF8.GetString(buf)
If DEFAULTTEXT = sReturn Then
sReturn = ""
End If
If DEFAULTTEXT.CompareTo(sReturn) = 0 Then
sReturn = "equal to default"
End If
Console.WriteLine(sReturn)
Console.ReadLine()
End Sub
Outputs 1, 0, 0, 1
There's no quotes, because they aren't in the string. The Bytebuf starts with ascii 49, which means "1". 44 is a comma, 32 a space.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
modified 4-Oct-18 8:36am.
|
|
|
|
|
I am trying to simulate the isdirty feature from Access. I want to check and see if anything has changed so I can prompt the user to save their work or lose it. So far I have written a subroutine that backs up the data in the form. But I am having problems with the code for the compare when they try and exit. So how do I compare the data I stored in the dataset with what is on the form?
Imports System.Data.SqlClient
Public Class Form1
Dim dsShiftLog As DataSet = New DataSet("ShiftLog")
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Shift_PrintersTableAdapter.Fill(Me.LazerMaintenanceDataSet.Shift_Printers)
Me.Shift_LogTableAdapter.Fill(Me.LazerMaintenanceDataSet.Shift_Log)
Backup_data(tbShift_Key.Text)
End sub
Private Sub Backup_data(ShiftKey As Integer)
Dim table1 As DataTable = New DataTable("shiftlog")
Dim strSql As String = "SELECT * FROM Shift_Log WHERE Shift_Log.Shift_Key = '" & ShiftKey & "';"
'Dim dtb As New DataTable
Using SqlConn As New SqlConnection(My.Settings.LazerMaintenanceConnectionString)
SqlConn.Open()
Using da As New SqlDataAdapter(strSql, SqlConn)
da.Fill(table1)
End Using
SqlConn.Close()
End Using
Dim table2 As DataTable = New DataTable("shiftprinters")
strSql = "SELECT * FROM Shift_Printers WHERE Shift_Printers.Shift_Key = '" & ShiftKey & "';"
'Dim dtb As New DataTable
Using SqlConn As New SqlConnection(My.Settings.LazerMaintenanceConnectionString)
SqlConn.Open()
Using da2 As New SqlDataAdapter(strSql, SqlConn)
da2.Fill(table2)
End Using
SqlConn.Close()
End Using
dsShiftLog.Tables.Add(table1)
dsShiftLog.Tables.Add(table2)
End Sub
|
|
|
|
|
Comparing the data would require a copy of said data and probably a lot of time.
Take the isdirty flag from notepad, as a simpeler example. If the user presses a key in that textbox (keydown), a boolean called "isDirty" is set to true - meaning the user edited the text, and now needs saving. Notepad doesn't compare the text to the old one; it merely checks if the user edited.
You can do the same; when loading from Access (or whatever), set a bool "isDirty" to false on load, and make it dirty on keypress.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
wjburke2 wrote: Dim strSql As String = "SELECT * FROM Shift_Log WHERE Shift_Log.Shift_Key = '" & ShiftKey & "';"
Don't do it like that!
Using string concatenation to create a SQL query leads to SQL Injection[^] vulnerabilities.
In this particular case, since the ShiftKey is an Integer , the query is OK. But it's a bad habit to get into, and there's nothing in your code to remind you to switch to using parameters if you ever change the method parameter to be a String .
You're also relying on VB's implicit type coercion to convert the text entered by the user into an Integer . That's going to be prone to throwing exceptions when the user mis-types the key. You should use Integer.TryParse[^] to attempt to convert the text, and display a message to the user if the conversion fails.
You don't need to explicitly open and close the connection; the data adapter will do that for you. It will also allow you to load both tables with a single command:
DataAdapter DataTable and DataColumn Mappings | Microsoft Docs[^]
Private Sub Backup_data(ByVal ShiftKey As Integer)
Const strSql As String = "SELECT * FROM Shift_Log WHERE Shift_Key = @ShiftKey; SELECT * FROM Shift_Printers WHERE Shift_Key = @ShiftKey";
Using SqlConn As New SqlConnection(My.Settings.LazerMaintenanceConnectionString)
Using da As New SqlDataAdapter(strSql, SqlConn)
da.SelectCommand.Parameters.AddWithValue("@ShiftKey", ShiftKey)
da.TableMappings.Add("Table", "shiftLog")
da.TableMappings.Add("Table1", "shiftprinters")
da.Fill(dsShiftLog)
End Using
End Using
End Sub
...
Dim ShiftKey As Integer
If Integer.TryParse(tbShift_Key.Text, ShiftKey) Then
Backup_data(ShiftKey)
Else
End If
Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]
How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]
Query Parameterization Cheat Sheet | OWASP[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
How you are binding your DataSet to controls? Are you using BindingSource ?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|