|
It actually only takes one byte. One byte is the smallest possible allocation unit in the Intel x86 architecture. The compiler maps your boolean value into that byte.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I created a DLL in VC++ 6.0. I am using it in VB 6.0. I
need to debug the DLL when I call a function in the DLL.
How do I do it from VB6?
1fm1fu
|
|
|
|
|
You are trying to do this backwards. What you do is create the VB6 application that calls the C++ DLL and then debug the DLL in the C++ debugger.
Robert
|
|
|
|
|
plz help me if any body have solution of this problem .
I have a big problem with .NET.
Short Description:
As long as I have an empty From in my Windows Application everything
works fine, but as soon as I add any kind of Control (e.g. a Button) to
the Form I get the following Exception in the InitializeComponents
method
*
An unhandled exception of type 'System.ArithmeticException' occurred in
system.drawing.dll
Additional information: Overflow or underflow in the arithmetic
operation.*
I read on a discussion board that this is caused by something called FPU
Exceptions which could be enabled by a hardware part of my machine.
Is there a Way to find out which part? Or is there a Way to turn them
off except the one on the MS Site?
Please help me if any body have solution of this problem
|
|
|
|
|
Hi all, i'm trying to create a new database in CE but it doesnt seem to work for some reason........can someone help? thanks!!
Imports System.Data.SqlServerCe
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'create DB
Dim engine As New SqlServerCe.SqlCeEngine("Data Source = \My Documents\test.sdf")
engine.CreateDatabase() 'error here
'connect to DB
Dim ssceconn As New SqlServerCe.SqlCeConnection("Data Source = \My Documents\test.sdf")
ssceconn.Open()
'ceate table
Dim sqlCreateTable As SqlServerCe.SqlCeCommand = ssceconn.CreateCommand()
sqlCreateTable.CommandText = _
"CREATE TABLE People(people_id int IDENTITY(0,1) PRIMARY KEY, f_name ntext, l_name ntext)"
sqlCreateTable.ExecuteNonQuery()
'inserting rows
Dim sqlInsertRow As SqlServerCe.SqlCeCommand = ssceconn.CreateCommand()
sqlInsertRow.CommandText = "INSERT INTO People(f_name, l_name) VALUES('John', 'Doe')"
sqlInsertRow.ExecuteNonQuery()
'close connection
ssceconn.Close()
End Sub
An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
Additional information: SqlCeException
|
|
|
|
|
It would appear that your connection string isn't valid. Specifically, my first suspect would be the path you provided for Data Source . But, your question really belongs in the Embedded/Mobile forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hmm ok. i'll try my luck in the Mobile forum. thanks for the reply anyway.
|
|
|
|
|
I’m trying to write a function that returns a datatable. Within the function I’m calling a stored procedure in access. The code looks like this:
Public Shared Function LoadSearchResults(ByVal whereClause As String) As DataTable
Dim SQL As String = " EXECUTE qrySearchResult"
Dim dt As DataTable = New DataTable()
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
dbConnection.Open()
'Dim Cmd As New OleDbCommand(SQL, dbConnection)
Dim Cmd As New OleDbCommand()
Cmd.CommandType = CommandType.StoredProcedure
Cmd.CommandText = "EXECUTE qrySearchResult"
Cmd.Parameters.Add(Cmd.CreateParameter())
Cmd.Parameters(0).Value = whereClause
'''''dr = Cmd.ExecuteReader()
''''''''''''''''''''
da.SelectCommand = Cmd
da.Fill(dt)
dbConnection.Close()
dbConnection.Close()
Return dt
End Function
How can I accomplish this?
Thanks,
Martin
|
|
|
|
|
Whatr's the problem ?
Why are you closing your connection twice ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
The problem here is that I don't know how to get a datatable from: dr = Cmd.ExecuteReader().
Please ignore the 2nd dbConnection.Close().
|
|
|
|
|
You can try this code to use your datareader to build your datatable
Dim table As New DataTable()
Dim row As DataRow
Dim rows As DataRowCollection
' read table schema from datareader
rows = DataReader.GetSchemaTable.Rows
'If you already know your field names you can use this
table.Clear()
table.Columns.Clear()
' Define the columns.
table.Columns.Add("Last Name", GetType(String))
table.Columns.Add("First Name", GetType(String))
table.Columns.Add("Phone Number", GetType(String))
table.Columns.Add("Email Address", GetType(String))
'Other wise do this
' use schema to create the columns for the new datatable
For Each row In rows
Dim col As New DataColumn()
col.ColumnName = row("ColumnName").ToString
col.Unique = System.Convert.ToBoolean(row("IsUnique"))
col.AllowDBNull = System.Convert.ToBoolean(row("AllowDBNull"))
col.ReadOnly = System.Convert.ToBoolean(row("IsReadOnly"))
col.DataType = Type.GetType(row("DataType").ToString)
table.Columns.Add(col)
Next
While DataReader.Read
row = table.NewRow
Dim col As DataColumn
For Each col In table.Columns
row(col) = DataReader(col.ColumnName)
Next
table.Rows.Add(row)
End While
Return table
Please let me know if this helped you.
|
|
|
|
|
You might also want to download this project and look at it. It has a class that might do what you are looking for.
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=352&lngWId=10\
|
|
|
|
|
You might also want to download this project and look at it. It has a class that might do what you are looking for.
http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=352&lngWId=10\
|
|
|
|
|
Thanks for all your help. I ended up doing this:
Public Shared Function LoadSearchResults(ByVal whereClause As String) As DataTable
Dim table As DataTable = New DataTable()
table.Columns.Add(New DataColumn("SSN"))
table.Columns.Add(New DataColumn("REFERRED"))
table.Columns.Add(New DataColumn("COMMENTS"))
table.Columns.Add(New DataColumn("ADDITIONAL1"))
table.Columns.Add(New DataColumn("ADDITIONAL2"))
table.Columns.Add(New DataColumn("ADDITIONAL3"))
Dim dr As OleDbDataReader
Dim da As OleDbDataAdapter = New OleDbDataAdapter()
Dim Cmd As New OleDbCommand()
Try
Cmd.Connection = dbConnection
Cmd.CommandType = CommandType.StoredProcedure
Cmd.CommandText = "qrySearchResult"
Cmd.Parameters.Add(Cmd.CreateParameter())
Cmd.Parameters(0).Value = whereClause
dbConnection.Open()
dr = Cmd.ExecuteReader()
Dim i As Int16
While dr.Read
Dim ar As ArrayList = New ArrayList()
For i = 0 To dr.FieldCount - 1
ar.Add(dr(i))
Next
Dim row As DataRow = table.NewRow()
row.ItemArray = ar.ToArray
table.Rows.Add(row)
End While
dbConnection.Close()
Return table
End Function
and It works fine except that MS Access ignores the where clause and returns all records. Do y ou know what I should do so that the query returs according to the where clause. below it the access query.
SELECT SSN, REFERRED, COMMENTS, Additional1, Additional2, Additional3
FROM MAIN
WHERE @WhereCluase;
|
|
|
|
|
I have a combo box in my form that take values from the other table in the database on form load.
On the Click Property of the Save Button i have put the code to clear the values of all text boxes and Combo Box after saving the data.
I used the following code to clear the combo box:
cboname.listindex = -1
The style of the combo box is set to 2-dropdown.
The data is saved to the database correctly but after that while clearing the text in the combo box it gives the Run Time Error No. 381 i.e. Invalid Property Array Index.
Can any body please tell me that what code should i do to clear those values in the combo box???
|
|
|
|
|
Hi Ali
Firt of all what are you working with windows forms or webforms.
in webforms we have dropdownlist which works similar to combobox to clear a dropdownlist or a combobox on a windows forms tryusing
cboname.items.Clear
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
I am working on VB 6 Forms. I think we will call them window forms. I dont know but also plz tell me that what should we call them?
Well i have tried the code u told me but its also not working.
it doesnt have that property of Items.
it gives the error of Data Method not found.
|
|
|
|
|
Well, my VB6 is a bit rusty, but IIRC, to clear just the TextBox portion of the ComboBox, set the ListIndex to 1, not -1. To clear out the entire ComboBox, it's ComboBox1.Clear().
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To clear all items in a combo box, you can use cboName.Clear where cboName is the name of the combo box.
|
|
|
|
|
This seems like it should be simple but I could not find any info anywhere to tell me how to do it.
Below is the code I am using in my datagrid and I need to format the number in this cell with ",".
When 123456789 is displayed (not entered) it needs to look like this 123,456,789
.Add(New System.Windows.Forms.DataGridTextBoxColumn)
With .Item(3)
.MappingName = "DriveSize"
.HeaderText = "Drive Size"
.Width = 115
.NullText = String.Empty
End With
If I try to put the .format member is the above code I get an error telling me it is not a member the datagrid columns style.
I have used the .format before to format money, but I don't know why
it won't work here. Can anyone tell me what I need to do to format this
cell?
|
|
|
|
|
I think your looks for something more like this:
Dim newColumn As New DataGridColumnStyle
With newColumn
.MappingName = "DriveSize"
.HeaderText = "Drive Size"
.Width = 115
.NullText = "String.Empty
.Format = "N"
End With
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you for your response. I had already been trying to use the .format member but with the way I was coding the columns it would not work. I would get an error telling me it was not a member of that object.
I finally tried a different way of coding for the columns (similar to yours) but I had to make other additional changes and I finally got it to work.
I appreciate your help. You made me rethink how I was approaching the column coding.
|
|
|
|
|
Has anyone got a routine to solve an optimization problem using the Simplex method?
Although I am aware of the Process to solve a Standard Maximization Problem using the Simplex Method, I have not even attempted to code it as I imagine that it is available on line.... and hopefully in vb 6 or .net
My application is to optimize the utilization (overall efficiency) of multiple equipment blocks based on block power, within certain constraints (numerical example as follows):
Maximize ntotal = ax + by + cz subject to
x + y + z <= 500
x <= 250
x >= 100
y <= 110
y >= 100
z <= 250
z >= 100
However, the coefficients a, b and c are functions as follows:
a = f(x), b=f(y) and c=f(z).
My planned approach is to use the standard simplex solution and iterate until the differences between two consecutive solutions for x, y and z are less than a defined limit. The values of a, b and c will be determined from a polynmial between each iteration based on the resultant x, y and z.
Finally, although I will use the routine locally (vb), I intended to run the calculation on line on data within a mySQL database using PHP.
Thanks for reading this and I will really appriciate any help!
karmond
|
|
|
|
|
You'd get much better results Googling for "Simplex method optimization".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using the following code from :http://www.kjmsolutions.com/datasetarray.htm[^]
to export data from a datagrid to Excel. The issue I have is that in my grid I have a field which holds the value: 00124544545454545 which represents a code.
Excel displays: 1+32323 a scientific number. I am at a loss on how to force a format to a cell to display this as text. The datagrid can show to datasets that differ in columns and thus it must be dynamic.
Any ideas?
Dim Excel As New Excel.Application
Dim oBook As Excel.Workbook
Dim WSheet As New Excel.Worksheet
Dim rows As Integer = dsDataset.Tables(0).Rows.Count
Dim columns As Integer = dsDataset.Tables(0).Columns.Count
Dim r As Integer
Dim c As Integer
Dim DataArray(rows, columns) As Object
Dim sString As String
WSheet = Excel.Workbooks.Add.Worksheets.Add
Excel.Visible = True
For c = 0 To columns - 1
DataArray(r, c) = dsDataset.Tables(0).Columns.Item(c).ColumnName
For r = 0 To rows - 1
DataArray(r, c) = dsDataset.Tables(0).Rows(r).Item(c)
Next
Next
'Transfer record data from array to Excel
WSheet.Range("A2").Resize(rows, columns).Value = DataArray
Dim columns2 As Integer
Dim columns3 As Integer = 1
For columns2 = 0 To dsDataset.Tables(0).Columns.Count - 1
WSheet.Cells(1, columns3).Value = dsDataset.Tables
(0).Columns(columns2).ColumnName
columns3 = columns3 + 1
Next
Cheers,
Scott
|
|
|
|