|
Usually, CPU intensive tasks use almost 100% of the CPU time, so the common way of measuring execution time is to make sure that the computer isn't doing anything else that is CPU intensive, and just measure the time spent.
The System.Diagnostics.StopWatch class is suitable for this.
There is no CPU independent or platform independent way to characterise execution speed. The speed is very much dependent on the CPU architecture, like cache sizes, memory speed, pipeline stall penalties, branch prediction, et.c. The efficiency of a specific combination of instructions can vary considerably from one computer to another.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thank you Guffa.
I already use stopwatch, but do you know if it counts the Real time passed or the allocated CPU time to the process, like the clock() function from C++?
If stopwatch measures real time, do you believe that it would be possible to be corrected in
some way by the allocated "% user time" (performance counter) of the process. As an example
lets say that a process runs from 2500 ms and the average process [% user time] is 80%. Is
it applicable to say [virtual time]=2500 ms x 80%= 2000 ms....
Konstantinos
|
|
|
|
|
hi,
i have a question: What event is used to resize the column of a datagridview?
thanks.
|
|
|
|
|
None. Events don't cause the resize to happen.
|
|
|
|
|
Hi,
I have an array of couple of millions of fields as byte.
The problem is In my function i need to resize the array everytime I pass through the function.
Using redim preserve array(i + someBigNumber)
And it is to slow... But speed in my app is a crucial argument.
Is there any faster way to resize the array and keep it's contents?
|
|
|
|
|
USe a list instead, it's a dynamic array. Which means the name 'list' sucks, but that's .NET for you.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
no...
but try to make a copy of this array by array. lib functions
Try
Dim SH*T as Mylife
Catch ex As Exception
msgbox("Im Happey Today")
End Try
|
|
|
|
|
|
1. Post a question normally, give a title and ask a question don't ask your question in your title and just say pls help.
2. You want findstring and you want to on textbox text changed, call this with the listbox and use the text as the string to check against. Check this out
|
|
|
|
|
good day again friends,
i again need your help on this one about datagridview in vb.net2005:
- i created a runtime columns which contains combobox control/ datagridviewcomboboxcolumn
- i set its datasource, and it runs smoothly
- my problem was, i dont know how to add another value which at the runtime of the application created, and display on the grid on the location where the combobox column located.
can someone help me on this... thank you...
your help; ideas, link, codes... are highly appreciated..
thank you
start a new beginning in every ending; thats what life for......
|
|
|
|
|
When i first started VB6 i used to hard code constants into a separate Module.
Then i moved on to using an ini file instead as this allowed me to change server paths and server names
plus other info without the need for recompiling code.
Now i'm onto and new to VB.NET i want to adopt a good practise and have started using an xml file instead which i then read into the application to initialise certain system properties.
What i want to know is what other people are doing or is there a better standard that
folks are using?
Many Thanks
|
|
|
|
|
don't know if this exist in 2003 but in 2005 there is a tab 'settings' on the properties of you'r project
here you can give a settingname, type, scope and value
this does exactly the same as what you do with the plus side that you can access these 'settings' in code like this:
my.Settings.nameofsetting
it basacly creates a xml file wich can be opened in notepad to alter it
I always use this
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
:-DExcellent, thanks.
Just the thing i was looking for.
|
|
|
|
|
Hola,
I use a package called AutoMod to make simulation models and to send messages from VB to this package teh AutoMod help says to use the next code
Call amxEvents.CallFunction("FsetMotorState", Array(1, Range("B10").Value))
However when I use this code in VB 2005 I get an error message that Array is a type and cannot be used like this.
What do I have to do in VB to get an array as the second argument?
Thanks in advance,
Nasko
See below for the syntax of the CallFunction method.
amx.CallFunction(funcName, params)
The syntax elements are defined as follows:
Syntax Element
Description
amx
An object variable that refers to the AutoMod runtime object.
CallFunction
The name of the method.
funcName
A string that indicates the name of the function in the AutoMod model that you want to call.
params
An array of variants that define the arguments required by the user-defined AutoMod function. The array must have as many values as the AutoMod function has arguments (any extra values are ignored). The variant values are automatically converted to the type of the associated argument in the AutoMod function in the model.
Note: The params syntax element is required. If the AutoMod function you are calling has no arguments, you must still define an empty array. For example:
Call amx.CallFunction("FAmodFunction", Array())
'An empty array is passed to the AutoMod function FAmodFunction
|
|
|
|
|
this is one way:
<br />
Dim a(Range("B10").Value) As Object<br />
a(0) = "mlqjf"<br />
Call amxEvents.CallFunction("FsetMotorState", a)<br />
you can replace object with string,integer,long,...
plus side of object is that you can put anything you want in it
down side the function callfunction might not know what to do with certain objects
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Thanks,
It worked.. the only thing I had to change was the Excel cell reference and change it to 0 (for a one dimension array).
So the problem is fixed... thanks!
|
|
|
|
|
Hello,
I am adding a column to datagridview.
The column values are numbers or empty string depending of the records returned from my SQL.
When I am sorting the column, it is sorted like string:
123
15
20
25
...
instead of
15
20
25
123
Please help
This is a part of my code:
'add the column to the datagridview
datagridview1.Columns.Add("SCQTYMV", "Qty Moved-In")
'CellFormatting Event
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
Try
With CType(sender, DataGridView)
If e.ColumnIndex = .Columns("SCQTYMV").Index Then
If .Rows(e.RowIndex).Cells("SCQTYMV").Value.ToString = "" Then
e.Value = ""
Else
e.Value = Cint(.Rows(e.RowIndex).Cells("SCQTYMV").Value)
End If
End If
End With
Catch ex As Exception
MessageBox.Show(ex.Message, "DataGridView1_CellFormatting", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Shay Noy
|
|
|
|
|
Hi All,
I have a table Named Table1 and i have displayed all the records in a datagridview and after i make changes ie.Edit the Datagird i want to save the changes to the same table after i click Update Button.
Can anyone tell me how to do this updation at a time not record by record
Example of what i have done:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Vidya\Visual Studio 2005 Projects\DatasetProject\Sample.mdb"
con.Open()
cmd.Connection = con
cmd.CommandText = "Select * from Table1"
da.SelectCommand = cmd
da.Fill(pTable)
DataGridView1.DataSource = pTable
dr = pTable.NewRow()
dr("Name") = "Doe"
dr("Place") = "John"
dr("Email") = "120"
pTable.Rows.Add(dr)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Cb As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(da)
da.Update(pTable)
MsgBox("Updated")
con.Close()
DataGridView2.DataSource = pTable
End Sub
When i give the da.Update(pTable) or dataset
It gives me following error:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
I think u have got what i am doing
Thank in advance
|
|
|
|
|
I got the Solution Its because we need to have a primary key for any one of the table
-- modified at 6:41 Wednesday 10th October, 2007
|
|
|
|
|
HiVidya110
Your code is mixedup. i dont see a dataset declaired in your code.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
i made a multi form application.but i don't know how to load a form using a button of main form.
-- modified at 1:22 Wednesday 10th October, 2007
|
|
|
|
|
You create an instance of he form class and call ShowDialog on it. If you didn't know this, you really need to buy a book and work through it, if you want to get anywhere.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
christian is correct
this is the first step in developing windows application..
lots of tutorials are available on net which starts from scratch..
better read them first.
nyways for this particaular problem of yours, here is the code..
in button click event of form1 code like this..
<br />
button1_click()<br />
dim a as new form2 'makes the instance for form2<br />
a.show() ' shows the form2 on clicking of button1<br />
me.close ' for closing of form1(optional) <br />
|
|
|
|
|
I always get an error message on my code below, what is it telling me?
ERROR MESSAGE:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in csrserver2.exe
Additional information: Exception from HRESULT: 0x800A03EC.
HERE IS MY CODE:
Private Sub BuildReport(ByVal stored_func() As String, ByVal report As String)
Dim db1 As New DbTier
db1.DbSource = GetSetting("CSR Server", "Data Source", "CSR", "")
db1.OpenConnection()
Dim i As Integer
Dim xl As Excel.Application
Dim wb As Workbook = mvarExcel.Workbooks.Open(mvarTemplate)
Dim ws As Worksheet
Dim rg As Excel.Range
Dim drd As OleDb.OleDbDataReader
For i = LBound(stored_func) To UBound(stored_func)
ws = wb.Worksheets(i + 1)
ws.Unprotect("crosby")
If i = 0 Then ws.Range("csr_title").Value = mvarCsrDetails(CsrIndex.Title) <---- ERROR HERE
drd = GetDataReader(db1, stored_func(i), mvarCsrDetails(CsrIndex.ID))
drd.Close()
Next
drd = Nothing
db1.CloseConnection()
db1 = Nothing
RaiseEvent OnAfterProcessDone("Saving " & report & ".")
Dim fleOutput As String = mvarOutputPath & UCase(mvarCsrDetails(CsrIndex.Title)) & " " & report & ".xls"
If File.Exists(fleOutput) Then File.Delete(fleOutput)
wb.SaveAs(fleOutput)
wb.Close(False)
End Sub
|
|
|
|
|
What is mvarCsrDetails(CsrIndex.Title) ? It's obviously blowing up the COM object.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|