|
Just out of interest the System.NullReferenceException was being thrown as I had declared the CallWindowProc function as:
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As IntPtr, ByVal hWnd As Long, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As String
I "cast" the return value to a string as I would subsequently call this function again to run procedures in the unmanaged dll that returned string values, and I knew no other way to read a string value from memory in .Net Even though I wasn't using the return value in the initial call to CallWindowProc the interop services obviously still attempted to use the value in eax as the address of a string, with the resulting exception being thrown. Simply declaring the return value as an Integer fixed the problem.
|
|
|
|
|
hi i had get the color through color dialog box and saved them in database nd then i want to set on the form?
then i want to set the color of dalog reading from the datbase but it gives error that cannot change readonly property.
System.drawing.color clr=new color();
clr.A=a;//read from db; //gives error that cannot change readonly property
.R=b;
.B=v//et
now i want to set the form color to this.
this.color=clr;
how to assign values to color variables?
Tasleem Arif
|
|
|
|
|
You can't change a color structure once you created it. Use the FromArgb method to create a color from the color components:
clr = Color.FromArgb(a, r, g, b);
---
b { font-weight: normal; }
|
|
|
|
|
Hi. I was wondering how I could use VB.Net code in VS2005 to split a wave file. I am new here I would like to learn some. I don't want others doing my work for me but I would like suggestions! I want to specify the time at which the wave file would be split into two different wave files where I could then save them as separate wave files. Does anybody have a clue? Please! I really need help!
Came here from VBForums......Thought people here could help me.
"Imagination is more important than knowledge." - Albert Einstein.
|
|
|
|
|
A wave file consists of a header and sound data. The header contains data like sample rate and sample size, that you need to know how the sound data is arranged.
What you need to do is to reader the header and the sound data, and construct new headers for the two new files, and split the sound data at the sample you calculate to be at the specified time.
One good source for file formats is Wotsit's format[^].
---
b { font-weight: normal; }
|
|
|
|
|
Hi, I am trying to populate a ComboBox with the contents obtained within an ArrayList, but instead of putting the names held within the ArrayList, it writes "System.Collections.ArrayList" in the place of the desired names.
Could you take a look at my code and see where I am going wrong.
I am using vb.net 2002 version.
Any help is greatly appreciated.
Many thanks
John
This is the code for the function selectFieldNames :-
Public fieldNames As New ArrayList()<br />
<br />
Public Function selectFieldNames(ByVal strSQL As String) As ArrayList<br />
' select all field names from the selected table<br />
sqlite_cmd.CommandText = (strSQL)<br />
' Now the SQLiteCommand object can give us a DataReader-Object:<br />
sqlite_datareader = sqlite_cmd.ExecuteReader()<br />
While sqlite_datareader.Read()<br />
Try<br />
fieldNames.Add(sqlite_datareader("name"))<br />
MessageBox.Show(sqlite_datareader("name"))<br />
Catch es As Exception<br />
MessageBox.Show(es.Message)<br />
End Try<br />
End While<br />
Return fieldNames<br />
End Function
This is the code for populating the ComboBox :-
Private Sub frmCreateIndex_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")<br />
dbConn.createSQLCommand()<br />
<br />
Dim a As Integer<br />
<br />
Try<br />
dbConn.selectFieldNames("pragma table_info(test)")<br />
For a = 0 To (dbConn.fieldNames.Count) - 1<br />
cmbFieldIndex.Items.Add(dbConn.fieldNames)<br />
Next a<br />
Catch es As Exception<br />
MessageBox.Show(es.Message)<br />
End Try<br />
End Sub
|
|
|
|
|
You setup an indexer to go through all the elements of fieldNames but you never used it to return an actual element in the array!
Try
dbConn.selectFieldNames("pragma table_info(test)")
For a = 0 To (dbConn.fieldNames.Count) - 1
cmbFieldIndex.Items.Add(dbConn.fieldNames)
Next a
Catch es As Exception
MessageBox.Show(es.Message)
End Try
Should be:
Try
dbConn.selectFieldNames("pragma table_info(test)")
For a = 0 To (dbConn.fieldNames.Count) - 1
cmbFieldIndex.Items.Add(dbConn.fieldNames(a))
Next a
Catch es As Exception
MessageBox.Show(es.Message)
End Try
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi, thanks for this, works a treat, I can't blieve I forgot to use the array.
Thanks again
John.
|
|
|
|
|
I want to develop sqlserver monitor ,tunerand analyzer please can you guide me how can i do this .. just give me a guideline .. or any opensource lib and prj u know
Features should include: Monitor SQL Server Hardware
requirements are
Utilization and Performance
Monitor CPU, memory, and the I/O subsystem percentages
Monitor disk operations (reads/writes) and network traffic
Correlate system utilization with user connections and SQL code
Diagnose Executed SQL Code Performance, Connections, and SQL Server Blocking
Analyze and chart slow performing SQL statements and stored procedures
Report the cost (Duration, CPU time, & disk reads/writes) of each statement
etc etc
R A M
|
|
|
|
|
SQL Server registers and populates a large number of performance counters - you can use the built in .NET class "PerformanceCounter" to get the current values from that for the first part of your requirement.
For the second part use the "SHOWPLAN" T-SQL commands.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
When I try to view a report inserted as Cerstal Report 11 report, LogOn Failed. I m using Orcle 8i Database.
|
|
|
|
|
I have a table with one column. This table has more than 1500 rows.
I want to print those 1500 rows of one column using 4 columns in the report(rdlc).
How is it possible?
|
|
|
|
|
This thing has driven me nuts the entire afternoon!
We have this unit to which we communicate over serialport that wants messages
in Unicode code points where C = 43, D = 44 etc.
If I want ASCII value for A i use Microsoft.VisualBasic.Asc("A") and get 65, problem is that A in Unicode is 41.
What to do??
|
|
|
|
|
|
jimithing77 wrote: A i use Microsoft.VisualBasic.Asc("A") and get 65,
As it should be. The decimal ASCII value is 65.
jimithing77 wrote: problem is that A in Unicode is 41
Not, it's not, it's 65. Convert decimal65 to hexadecimal and you get 41, or in VB notation &H41.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm sure there is a way to do it. But I don't have time to look, so I was just going to suggest that if you can't find a way, you could always write your own function that looks it up for you, like this:
Public Function GetCode(str as string) as Integer
Select Case str.Trim.ToUpper
Case "A"
Return 41
'Continue with other cases...
End Select
End Function
Or if you discover that the Microsoft.VisualBasic.Asc is consistant you could just say cint(Microsoft.VisualBasic.Asc(char)) - 24
Sorry I couldn't find a nicer answer.
|
|
|
|
|
Ah... I did think they were the same, but I didn't spot that little wrinkle when I read it, I just filed it as something to check on later.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, consider it checked then!
Something just looked familiar, and wrong, about those two numbers the way he was describing them. I knew 65(dec) was uppercase A, but 41?? Not in any character table I've ever seen! Then I opened the ASCII chart in Visual Studio Help and the problem was staring me right in the face.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am using VB.NET (2003) to create a Windows form to interface with a SQL 2000 database. I need to validate the user input of an employee number with the table that contains the valid numbers. All I want to do is validate the information and move on, or pop a messagebox up. My problem is getting the code right to loop the array for the comparison function.
I also hope to match the USERID and integrate this into the validation process to further verify that the proper person is being identified.
Thank you in advance.
LW
LWhite
|
|
|
|
|
i don't know if this will help you but i hope it will
my suggestion is:
1. you save the use input in a variable
2. query database for that input
3. if the query result is 0 then the employee number is not exist, give warning
4. else then number is exist go to next process
I'm assuming you have a table called TabEmployees with a field called EmployeeNo and using microsoft access 2000 database file. here's the code
private function isEmpExist(byval EmpNo as integer) as boolean
dim CN as new oledbconnection
dim R as integer
cn.connectionstring="provider=microsoft.jet.oledb.4.0"
dim Cmd as oledbcommand=cn.createcommand
with cmd
'set commandtype as commandtext
.commandtext="SELECT EmployeeNo FROM TabEmployees WHERE EmployeeNo = " & EmpNo.tostring.trim
end with
r=cmd.executenonquery
if isnothing(r) then
return false
else
return true
end if
cn.close
end function
hope you find this useful, and i'm sorry if this code doesn't do as it should, but i think it will only might produce syntax error, coz i'm typing it directly here without VB. well then good luck!
|
|
|
|
|
ups sorry, i think i made mistake in that code, the line
r=cmd.executenonquery should have been
r=cmd.executescalar , sorry...
|
|
|
|
|
Thank you very much for responding. I plugged in the code and modified to match my database settings and have a syntax error. I should be able to find the error with a little troubleshooting. The error appears to be in the .CommandText line. Here is my modified code:
Private Function isEmpExist(ByVal EmpNo As Integer) As Boolean
Dim CN As New SqlConnection
Dim R As Integer
CN = (New SqlConnection("Integrated Security=False; User id= testuser; password= xxx; Server=xxx; Initial Catalog=Galley"))
Dim Cmd As SqlCommand = CN.CreateCommand
With Cmd
'set commandtype as commandtext
.CommandText = "SELECT emplid FROM users WHERE emplid = " & editEMPLID.ToString.Trim
End With
CN.Open()
R = Cmd.ExecuteScalar
If IsNothing(R) Then
Return False
Else
Return True
End If
CN.Close()
End Function
Again, I very much appreciate the assist. I've been banging my head against the wall for a few days on this one. This should be a simple comparison and validation.
LWhite
|
|
|
|
|
Hi, I have written some code that will populate 6 random numbers into 6 seprate labels, but before I can add the code to colour code these labels I need to sort the labels into accending order, as this is an assignement I have been asked to use the bubble sort. Below is a sample of the code that selects the numbers and places them into the labels then I get stuck in writing the code for the bubble sort..... any help is appreciated!!
Selects the numbers:
Dim numbers(3) As Integer
Dim counter As Integer
numbers(0) = Int(Rnd() * 49) + 1
Do
numbers(1) = Int(Rnd() * 49) + 1
Loop While numbers(1) = numbers(0)
Do
numbers(2) = Int(Rnd() * 49) + 1
Loop While numbers(2) = numbers(1) Or numbers(2) = numbers(0)
Do
numbers(3) = Int(Rnd() * 49) + 1
Loop While numbers(3) = numbers(0) Or numbers(3) = numbers(2) Or _
numbers(3) = numbers(1)
For counter = 0 To 3
'This will update the random numbers in the labels
lblLottoBall1.Text = numbers(0)
lblLottoBall2.Text = numbers(1)
lblLottoBall3.Text = numbers(2)
lblLottoBall4.Text = numbers(3)
|
|
|
|
|
A bubble sort is a nested loop. So you have two loops, each iterating over all elements and swapping an element with the one next to it, if they are in the wrong order. So, it's just two loops. You should have a go at implimenting this and if you get stuck, post the code and ask for more help.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Have a look here[^]
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|