|
Thanks for corrections, I seldom have need to use API calls.
Dave Kreskowiak wrote: I'll make an educated guess and say that you lifted some VB6 code
Close - API Viewer 2004
Dave Kreskowiak wrote: Under VB6, the Long type is a 32-bit signed integer, while under VB.NET, the Long type is a 64-bit signed integer.
I thought Long was Long regardless, my mistake
Great advice, thanks!
|
|
|
|
|
Dear friends,
thanks for the timely help.
|
|
|
|
|
How can I create a shared memory zone? I'm using this zone to create a bridge between two aplications. The code is written in vb.net.
A perfect exemple for this is having a printer listener and a program that needs to print throught the printer listiner. I found another way to do that fast but accesing a shared memory zone is still a problem form me.
How can i use the api's for creating and comunicating threads from vb.net. i don't have the strucures needed?
P. Sorin
|
|
|
|
|
i have no idea about this but look into appdomain. this may allow you to access what you need.
else
put a listener on your printer program and have you app call it using TCP/UDP to give it instructions.
|
|
|
|
|
You might want to look at the source in this[^] article for an example of implementing shared memory.
There's also this[^] article and this[^] one that get into a bit.
But, in all cases, you'll have to manage this shared area yourself. There is no support in the .NET BCL for shared memory or memory mapped files.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
A simple question.Please help me in this.
Const ma111VID As Short = &H846S
What does the "S" stand for in &H846S?
Const RFCMD_REPRGM_CONFIRM As Int16 = &H691A
What does the "A" stand for in &H691A?
|
|
|
|
|
Dont double post!
Posted by The ANZAC
|
|
|
|
|
ashwath1979 wrote: Const ma111VID As Short = &H846S
The literal type character 'S' just means that the number, hexadecimal 846, should be forced to a Short datatype. In this case, it's meaningless because the type that the literal is being assigned to is already a Short. In other words, the 'S' is redundant.
ashwath1979 wrote: Const RFCMD_REPRGM_CONFIRM As Int16 = &H691A
The 'A' is part of the number, not like the 'S' in your previous example. The '&H' part specifies that the number is in hexadecimal format. Hexadecimal is Base16, which has values that go from 0 to F (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). In your example, the number in hex is 691A, or decimal 26906.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hi there,
I Have a Dataset(vb.net) and that can be contain apostrophes(') in fields. I need to replace all apostrophe with the space character. Is there any way to solve the simple update (without loop) ?
thanks
Murat TURHAN
|
|
|
|
|
From where r u filling the Dataset?
If you are filling it from the DB then the best solution is to replace it in the query.
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
Yes i m filling from DB but source is constant changing.
therefore tables and fields are uncertain. Dataset is creating dinamically.
Murat TURHAN
|
|
|
|
|
Const ma111VID As Short = &H846S
What does the "S" stand for in &H846S.
Const RFCMD_REPRGM_CONFIRM As Int16 = &H691A
What does the "A" stand for in &H691A.
|
|
|
|
|
Is there something wrong with this line ...
Dim totValue As Integer = CInt(tblDataTable.Compute("SUM(Value)", "Product = 'P199'"))
It doesn't seem to do anything. I put totValue into a messagebox immediately after it, but it simply ignores it and carries on - infact a Try ... Catch in the same area is invoked unnecessarily.
So, I tried removing the 'filter' part of compute (I'm still new to this, and I believe that its optional), so that I had:
Dim totValue As Integer = CInt(tblDataTable.Compute("SUM(Value)"))
But this just underlines the tblDataTable.Compute("SUM(Value)") part in my code, with the 'tooltip', "Argument not specified for parameter 'filter' of 'Public function compute'.
What am I doing wrong?
|
|
|
|
|
penguin5000 wrote: CInt
You should not use this, it's VB6 nastiness. Use Convert.ToInt32 instead, or int.Parse.
The MSDN samples put Sum, not SUM. I wonder if it's case sensitive ?
I'd break it into steps, so you can see which one fails.
Christian Graus - C++ MVP
|
|
|
|
|
Unfortunately, it still isn't working. Is it the way I'm constructing my DataTable? The relevant section is as follows. I'd really appreciate some pointers:
Dim myStreamReader As StreamReader = New StreamReader(txtFilePath.Text)<br />
Dim strLine As String<br />
Dim strProdCode As String<br />
Dim strTransCode As String<br />
Dim intQuantity As Integer<br />
Dim intValue As Integer<br />
Dim intRunningQuantityTotal, intRunningValueTotal As Integer<br />
Dim intNumberOfRows As Integer<br />
Dim tblDataTable As New DataTable<br />
<br />
tblDataTable = New DataTable("TrxContents")<br />
<br />
Dim colProds As DataColumn = New DataColumn("Product")<br />
Dim colTrans As DataColumn = New DataColumn("Trans Code")<br />
Dim colQty As DataColumn = New DataColumn("Quantity")<br />
Dim colValue As DataColumn = New DataColumn("Value")<br />
Dim row As DataRow<br />
<br />
tblDataTable.Columns.Add(colProds)<br />
tblDataTable.Columns.Add(colTrans)<br />
tblDataTable.Columns.Add(colQty)<br />
tblDataTable.Columns.Add(colValue)<br />
<br />
intRunningQuantityTotal = 0<br />
intRunningValueTotal = 0<br />
intNumberOfRows = 0<br />
intOriginalLines = 0<br />
<br />
Try<br />
<br />
Do While myStreamReader.Peek <> -1<br />
strLine = myStreamReader.ReadLine()<br />
intOriginalLines = intOriginalLines + 1<br />
<br />
If strLine.Substring(0, 1) = "K" Then<br />
row = tblDataTable.NewRow()<br />
intNumberOfRows = intNumberOfRows + 1<br />
<br />
'Read the Product Code (start at pos 6. 26 chars long)<br />
strProdCode = strLine.Substring(5, 26)<br />
row.Item("Product") = strProdCode<br />
<br />
'Read the transaction code (start at pos 63. 2 chars long)<br />
strTransCode = strLine.Substring(62, 2)<br />
row.Item("Trans Code") = strTransCode<br />
<br />
'Read the Quantity (start at pos 74. 12 chars long)<br />
intQuantity = strLine.Substring(73, 12)<br />
row.Item("Quantity") = intQuantity<br />
intRunningQuantityTotal = intRunningQuantityTotal + intQuantity<br />
<br />
'Read the Value (start at pos 86. 14 chars long)<br />
intValue = strLine.Substring(85, 14)<br />
row.Item("Value") = intValue<br />
intRunningValueTotal = intRunningValueTotal + intValue<br />
<br />
tblDataTable.Rows.Add(row)<br />
<br />
End If<br />
<br />
Loop<br />
myStreamReader.Close()<br />
<br />
Dim ds As New DataSet<br />
ds = New DataSet<br />
<br />
Dim totValue As Integer = Convert.ToInt32(tblDataTable.Compute("Sum(Value)", "Product = 'P199'"))<br />
MessageBox.Show(totValue)<br />
<br />
ds.Tables.Add(tblDataTable)<br />
Me.grdDataGrid.SetDataBinding(ds, "TrxContents")<br />
<br />
Catch<br />
<br />
... some stuff<br />
<br />
End Try
Thanks in advance.
|
|
|
|
|
Best guess, looking at this code, Value is not a numeric type, which means that Sum won't work on it.
Christian Graus - C++ MVP
|
|
|
|
|
Thanks.
A couple of minor changes:
Dim colValue As DataColumn = New DataColumn("Value", GetType(Integer))<br />
<br />
intValue = Integer.Parse(strLine.Substring(85, 14))
|
|
|
|
|
*grin* Glad to help.
Christian Graus - C++ MVP
|
|
|
|
|
Can you write me why is vb.net batter then oracle? I just want to know...
|
|
|
|
|
u're sentece is out of mind.. we don't understand u. u compares an apple with a car.. oracle is a company and vb.net is a programming language
|
|
|
|
|
I have a problem for datagrid. For now i am able to display wat i wan on the datagrid but the users are able to edit the data on the datagrid and in turn corrupt my DB. What can i do to allow the user to read only but not to write?? Urgent... thanks a lot....
|
|
|
|
|
Subjugate wrote: What can i do to allow the user to read only but not to write??
datagrid1.ReadOnly = true
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Where should i enter tis line. In the datagrid or in the button? Cos in order to activate my datagrid i need to click on a button 1st.
|
|
|
|
|
at the design time set the readonly property to true.
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|