|
|
|
if driver file dvr card is .sys only file
Can i use directx for develop ?
|
|
|
|
|
*sigh* If you have a video device, then DX is the only way to work with it, unless they offer an SDK. Trying some of the example code on this site will tell you if it works with DX. Didn't I tell you this yesterday ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Has anyone had experience executing Oracle stored procedures with input & output parameters with VB.net? I've researched online help, articles websites etc. but it does not work. The stored procedure has 5 parameters. The first 3 are Ouput, the 4th is In/Out and the 5th is Input. Here is a sample of the code being used:
Dim cmdAPI As OracleClient.OracleCommand
Dim drAPI As OracleClient.OracleDataReader
'specify API and setup command
pstrSQL = "Oracle_API_test"
cmdAPI = New OracleClient.OracleCommand(pstrSQL, pcnnOra)
cmdAPI.CommandType = CommandType.StoredProcedure
'setup stored procedure parameters
Dim info_ As New OracleClient.OracleParameter("info_", OracleClient.OracleType.VarChar, 256)
Dim objid_ As New OracleClient.OracleParameter("objid_", OracleClient.OracleType.VarChar, 256)
Dim objversion_ As New OracleClient.OracleParameter("objversion_", OracleClient.OracleType.VarChar, 256)
Dim attr_ As New OracleClient.OracleParameter("attr_", OracleClient.OracleType.VarChar, 2000)
Dim action_ As New OracleClient.OracleParameter("action_", OracleClient.OracleType.VarChar, 256)
'set value of parameters
cmdAPI.Parameters.Add(info_)
cmdAPI.Parameters(0).Direction = ParameterDirection.Output
cmdAPI.Parameters.Add(objid_)
cmdAPI.Parameters(1).Direction = ParameterDirection.Output
cmdAPI.Parameters.Add(objversion_)
cmdAPI.Parameters(2).Direction = ParameterDirection.Output
cmdAPI.Parameters.Add(attr_)
cmdAPI.Parameters(3).Direction = ParameterDirection.InputOutput
cmdAPI.Parameters(3).Value = "'PART_NO'||chr(31)||'LG003'||chr(30)||" _
& "'DESCRIPTION'||chr(31)||'Test Part3'||chr(30)||" _
& "'UNIT_CODE'||chr(31)||'EA'||chr(30)||" _
& "'CONDITION_CODE_USAGE'||chr(31)||'Not Allow Condition Code'||chr(30)"
cmdAPI.Parameters.Add(action_)
cmdAPI.Parameters(4).Direction = ParameterDirection.Input
cmdAPI.Parameters(4).Value = "'DO'"
'execute stored procedure
cmdAPI.ExecuteOracleNonQuery(0)
'analyze parameter values
strTmp = IIf(IsDBNull(cmdAPI.Parameters(0).Value), "null", cmdAPI.Parameters(0).Value)
TextBox1.Text = strTmp
strTmp = IIf(IsDBNull(cmdAPI.Parameters(1).Value), "null", cmdAPI.Parameters(1).Value)
TextBox2.Text = strTmp
strTmp = IIf(IsDBNull(cmdAPI.Parameters(2).Value), "null", cmdAPI.Parameters(2).Value)
TextBox3.Text = strTmp
strTmp = IIf(IsDBNull(cmdAPI.Parameters(3).Value), "null", cmdAPI.Parameters(3).Value)
TextBox4.Text = strTmp
strTmp = IIf(IsDBNull(cmdAPI.Parameters(4).Value), "null", cmdAPI.Parameters(4).Value)
TextBox5.Text = strTmp
cmdAPI.Dispose()
pcnnOra.Close()
Larry G
Prodev Solutions
|
|
|
|
|
Is it giving you an error? Are you setting the values in the procedure?
Mike Lasseter
|
|
|
|
|
Thanks for replying Mike. I have it working now. Needed to change the parameter value text to better suit the VB.net environment instead of the literal SQL/plus environment.
Larry G
Prodev Solutions
|
|
|
|
|
Please help me about listview
i want to have rows with multiline text. what shall i do?
labelwarp is working just in icon mode , I want it in detail mode.
Alvin.
|
|
|
|
|
You have to ownerdraw the ListView controls items. Just Google for "vb.net owner draw listview[^]" and you'll come up with tons of examples.
|
|
|
|
|
Hi! I would like to; "really" know how to get the current text line number where the caret is at.
(not the "line number" just the "text line number":
when you use textbox1.lines(0) it takes the entire text in line 0 even if some text are in line 1, because the text in line 1(as long as it didn't get there by pressing the return key) belongs to line 0, but when I use the code below it just says the text in line 1(even thought it belongs to line 0) as belonging to line 1.)
a = Rtb.GetLineFromCharIndex(rtb.SelectionStart)
So can anyone tell me a way to get the real line number of the selected text.
thanks in advance
|
|
|
|
|
Reposting the same question in the same day won't get it answered any faster.
The RTB doesn't support giving you the screen text line of the caret. The screen line of text also doesn't have any meaning. What screen text line is the caret on if the top line of text displayed is only partially visible?? See what I mean?
You can get the position of the first character of the line, but there is no method to convert that position to a screen text line.
So what are you trying to do with this anyway??
|
|
|
|
|
never mind I found a way.
|
|
|
|
|
|
I'm having trouble with some code to convert a 24bpp image to a 1bppindex image. I get an exception when I do a Marshal.copy of the destinationBuffer back to the 1bpp image. The exception message is: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
If my destination bitmap is an 8bppindex image or higher (ie. 24rgbbpp) the problem doesn't occur.
Public Function ConvertToBitonalNew(ByVal original As Bitmap) As Bitmap
Dim source As Bitmap
source = original
Dim rect As New Rectangle(0, 0, source.Width, source.Height)
Dim bmpData As BitmapData = source.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat)
Dim ptr As IntPtr = bmpData.Scan0
Dim imageSize As Integer = source.Width * source.Height * 3
Dim sourceBuffer(imageSize - 1) As Byte
Marshal.Copy(ptr, sourceBuffer, 0, imageSize)
source.UnlockBits(bmpData)
Dim destBmp As Bitmap = New Bitmap(source.Width, source.Height, PixelFormat.Format1bppIndexed)
destBmp.SetResolution(source.HorizontalResolution, source.VerticalResolution)
Dim destData As BitmapData = destBmp.LockBits(New Rectangle(0, 0, destBmp.Width, destBmp.Height), ImageLockMode.ReadWrite, destBmp.PixelFormat)
Dim ptrDest As IntPtr = destData.Scan0
imageSize = destBmp.Width * destBmp.Height
Dim destBuffer(imageSize) As Byte
Dim y As Integer = 1
For x As Integer = 2 To sourceBuffer.Length - 1 Step 3
If sourceBuffer(x) > 128 Then
destBuffer(y) = CByte(1)
Else
destBuffer(y) = CByte(0)
End If
y = y + 1
Next x
'the line below throws an exception
Marshal.Copy(destBuffer, 0, ptrDest, destBmp.Width * destBmp.Height)
destBmp.UnlockBits(destData)
source.Dispose()
Return destBmp
End Function
End Class
Steve T.
|
|
|
|
|
You might want to check out this[^] little article. For better performance, I'd also suggest writing this in C# because of the benefits of pointers. Something VB.NET doesn't support...
|
|
|
|
|
I got this figured out. The following code corrects the problem I was having. This is very useful for people who need to modify and save compressed Tiff images.
imageSize = destData.Stride * destData.Height
Dim destBuffer(imageSize) As Byte
Dim srcIDX As Integer = 0
Dim destIDX As Integer = 0
Dim DestValue As Byte = 0
Dim PixelValue As Integer = 0
Dim PixelTotal As Integer = 0
Try
For y As Integer = 0 To source.Height - 1
srcIDX = y * bmpData.Stride
destIDX = y * destData.Stride
PixelValue = 128
DestValue = 0
Dim x As Integer
Try
For x = 0 To source.Width - 1
PixelTotal = sourceBuffer(srcIDX + 1)
If PixelTotal > 128 Then DestValue += CByte(PixelValue)
If (PixelValue = 1) Then
destBuffer(destIDX) = DestValue
destIDX = destIDX + 1
DestValue = 0
PixelValue = 128
Else
PixelValue >>= 1
End If
srcIDX += 4
Next
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "")
End Try
If (PixelValue <> 128) Then
destBuffer(destIDX) = DestValue
End If
Next
Marshal.Copy(destBuffer, 0, ptrDest, imagesize)
Steve T.
ST
|
|
|
|
|
I am working on a program that will search for files and add the files to a listbox(listbox1). Here is the code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
GetDirectoryContents(TextBox1.Text.Split(New String() {";"}, StringSplitOptions.RemoveEmptyEntries), TextBox2.Text.Split(New String() {";"}, StringSplitOptions.RemoveEmptyEntries))
End Sub
Private Sub GetDirectoryContents(ByVal dirs() As String, ByVal patterns() As String)
'Declare variable.
Dim dDir As DirectoryInfo
For Each sDir As String In dirs
If Not Directory.Exists(sDir) Then Continue For
dDir = New DirectoryInfo(sDir)
For Each ext As String In patterns
For Each fi As FileInfo In dDir.GetFileSystemInfos("*." & ext)
ListBox1.Items.Add(fi.Name)
Next
Next
Next
End Sub
I have created a table in access named tblExcluded which includes excluded files. I want to be able to check that table to see if specific files are in the table. If those files are in the table then add them to listbox2 and all other files that don't exist in the table store then in listbox1. The table contains a ID field and a the file path field. Does any one have any sample code that will perform this? Any suggestions would help.
|
|
|
|
|
I think my brain is turning to mush over this. Ive been looking at events and the order that they're fired to figure out the best place to control the entries in the comboboxes and textboxes. By allowing databinding through the textboxes I need to stop the user from changing rows if they havent entered everything correctly BUT if I use the CellValidating and call e.Cancel = True then obviously that prevents ALL events from completing because even closing the form calls the cell validating event.
So I would appreciate any suggestions regarding how to validate the entries and prevent the row from being changed (since it then attempts to save the value in the row being switched from) without preventing the form from being closed etc...
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Maybe I am missing something here, but in your datatable and dataset on the back end which is where the data should be changing, you have to call AcceptChanges() for the dataset to keep those changes. You can always call RejectChanges() and rebind the datagridview and their stuff would not be saved. Maybe I am missing something.
Ben
|
|
|
|
|
Where would I call those methods? I just started messing around with the RowChanged event in the partial class of the dataset and that doesnt seem to set the errors correctly. I used to do this all by my own code but this time I am trying to keep working with what I inherited and that is a databound DataGridView and I have added the databound functionality to the textboxes and comboboxes in order to pull the editing out of the grid. The problem is that I am getting different errors than I have ever gotten since it tries to apply the update when the row changes and it is obviously happening before the form's grid's RowChanged and SelectionChanged events.
Like I said the CellValidating works but when I call e.Cancel = True it prevents all events from firing.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Well, if you want to continue to do it that way, you should probably be in a different event. The RowChanging event is where you could set the dataSet.AcceptChanges() or dataSet.RejectChanges(). RowChanging happens before the row is committed. Once you get to RowChanged the Row has already been changed unless you cancel.
Ben
|
|
|
|
|
The Row_Changing is not firing before I get the following.
---------------------------<br />
DataGridView Default Error Dialog<br />
---------------------------<br />
The following exception occurred in the DataGridView:<br />
<br />
<br />
<br />
System.Data.NoNullAllowedException: Column 'ColumnName' does not allow nulls.<br />
<br />
at System.Data.DataColumn.CheckNullable(DataRow row)<br />
<br />
at System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction, Boolean fireEvent)<br />
<br />
at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception& deferredException)<br />
<br />
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Boolean fireEvent)<br />
<br />
at System.Data.DataRow.EndEdit()<br />
<br />
at System.Data.DataRowView.EndEdit()<br />
<br />
at System.Windows.Forms.CurrencyManager.EndCurrentEdit()<br />
<br />
at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32 newPosition, Boolean validating, Boolean endCurrentEdit, Boolean firePositionChange, Boolean pullData)<br />
<br />
at System.Windows.Forms.CurrencyManager.set_Position(Int32 value)<br />
<br />
at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)<br />
<br />
<br />
<br />
To replace this default dialog please handle the DataError event.<br />
---------------------------<br />
OK <br />
---------------------------
This comes up immediately and the only thing that fired before it was the CellValidating.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
It sounds like in your datatable you have a column where allownulls it set to false. The only time you should do that is if a default value is set that is not null or you have marked that column as an identity column. So when the insert happens if a column do not allow nulls and the default value is null you will get that error.
Ben
|
|
|
|
|
Alright, I set the AllowNulls to True and the DefaultValue to 0 and I still get the error. This .NET 2.0 binding is sooooooooo frustrating.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
It sort of was the first time I did it too. You get over these little gotchas and then it works nice. It is just the inital learning curve.
Well, according to your error message it is the columnName that does not allow nulls. So you must have a column in your datatable that doesn't have a name for some reason. I didn't read the error close enough the first time.
Ben
|
|
|
|