|
This code is working properly
DataEnvironment1.Commands("Command1 ").CommandType = adCmdText
DataEnvironment1.Commands("Command1 ").CommandText = "Select * from TenderBlocksCalcolations where ProjectsCode = '" & txtProjectCode.Text & "'"
But when i make grouping its not works
DataEnvironment1.Commands("Command1_Grouping").CommandType = adCmdText
DataEnvironment1.Commands("Command1_Grouping").CommandText = "Select * from TenderBlocksCalcolations where ProjectsCode = '" & txtProjectCode.Text & "'"
Can you give any idea?
|
|
|
|
|
Yeah, you don't have any GROUP BY clause in your SQL statement.
You might want to read up on it here[^].
|
|
|
|
|
My purpose is to identify a specific USB device which, once installed via its driver, will go under the COM Port devices, appearing with a speficic name and a specific GUID Class ID will be defined for it as well.
If I want to access this device, is there a way for detecting which COM port has been assigned by Windows? If yes, it would be possible to automatically attach to it without asking the user to check and then select the right COM port.
SepPax
modified 16-May-15 11:52am.
|
|
|
|
|
|
The example you posted will return the COM Port names (COM1, COM2, COMx...).
My need is different.
Assume to have a USB device named "USB Dev" connected to COM7.
What I want to achieve is finding out on which COM port the device 'USB Dev' is connected, therefor locate it via its name.
Possible?
SepPax
modified 13-May-15 18:38pm.
|
|
|
|
|
Use the suggestion, write the code, report the results.
Then, if it doesn't work, ask for further assistance.
|
|
|
|
|
Works well with name search
Dim port as string
Dim device as string
Try
Using searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_SerialPort")
For Each queryObj As ManagementObject In searcher.Get()
port = queryObj("DeviceID")
device = queryObj("Description")
Next
End Using
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
check device for what you look for.
SepPax
|
|
|
|
|
I have code to select a specific cell in a DataGridView control:
With dgvPlanAssemblies
.ClearSelection()
.CurrentCell = .CurrentRow.Cells("RoughPriceOverrideCol")
End With
The selection does indeed move to the correct cell. The problem is that the focus does not move. I have tried to use the .Selected = True method and BeginEdit:
With dgvPlanAssemblies
.ClearSelection()
.CurrentCell = .CurrentRow.Cells("RoughPriceOverrideCol")
.CurrentRow.Cells("RoughPriceOverrideCol").Selected = True
.BeginEdit(True) ' Also tried False '
End With
Nothing I tried method moves the focus to the selected cell.
Any help is appreciated.
|
|
|
|
|
Hi guys,
does anybody have a good and proven serial data receive routine (example) to share with me?
My data are structured as following:
[start of frame][frame length][data....][end of frame]
Everything is HEX bytes, so guess can't use string reading.
Basically need a buffer where to look for the start, wait for the frame to be received til its end, process the frame and remove the processed part of buffer from the remaining buffer.
Any help and hint is welcome.
SepPax
|
|
|
|
|
|
useful, something more advanced to suggest?
SepPax
|
|
|
|
|
Did you take a look at these Codeproject articles[^]?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Not yet, but will. Thanks for the lead
SepPax
|
|
|
|
|
SepPax wrote: something more advanced to suggest? Yes, learn to make an effort to do your own research. Google will find you plenty of samples and articles.
|
|
|
|
|
hmmm, greatly appreciate your help...your suggestion tells me a lot.
Checking the forum, for me at least, is sometimes the way for optimizing the development time, of course, when people are willing to share their experience with others, allowing those others to take advantake of their skill, their trial and error, their optimizing etc.
When people are not willing to share, well, then of course there is a huge amount of things out there you can reach via BigG.
Nothing personal, but why should people spend time on feeding and maintaining specific and specialized forum(s), if the final goal is fooling around with Google?
Cheers.
SepPax
|
|
|
|
|
Look at the question you asked:
SepPax wrote: something more advanced to suggest? So what are we to guess from that? How much more advanced, what level of experience do you have that we can respond to ... ? As you see it's an impossible question to answer. I suggest you read http://www.codeproject.com/Messages/1278601/How-to-get-an-answer-to-your-question.aspx[^]. Only by thinking carefully about exactly what problem you are facing, and providing a clear explanation, can we begin to think of ways to help you.
|
|
|
|
|
Well Richard,
can't say you are wrong... will try my best to improve
SepPax
|
|
|
|
|
Hi guys,
getting crazy about this issue, can't figure out the reason. I'm sure that a more skilled eye than mine can get the point, any help is welcome.
I get the below error (see end of the code).
Basically I have a decoding function feeded with a key (pbKey), an input array (pbIn) and an output array (pBout).
Don't understand what VB is asking for...
Seppax
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim k As Byte() = {&H1F, &H33, &H52, &H59, &H02, &H04, &H77, &H67, &H13, &H0E, &H00, &H15, &H15, &H02, &H0F}
Dim dat As Byte() = {&H5F, &H4F, &HDA, &HA3, &H97, &H14, &H81, &HB1}
Dim s, a As String
Dim out As Byte()
TeaD(k, dat, out)
End Sub
Private Function TeaD(ByVal pbKey() As [Byte], ByVal pbIn() As [Byte], ByVal pbOut() As [Byte]) As Byte()
Dim i As [Byte] = New [Byte]()
Dim y As UInteger
Dim z As UInteger
Dim sum As UInteger = &HC6EF3720UI
Dim delta As UInteger = &H553569AAUI
Dim n As UInteger = 32
Dim k(4) As UInteger
y = pbIn(2)
z = pbIn(6)
k(0) = pbKey(2)
k(1) = pbKey(6)
k(2) = pbKey(10)
k(3) = pbKey(14)
For i = 0 To 2
y <<= 8
z <<= 8
k(0) <<= 8
k(1) <<= 8
k(2) <<= 8
k(3) <<= 8
y = y Or pbIn(2 - i)
z = z Or pbIn(6 - i)
k(0) = k(0) Or pbKey(2 - i)
k(1) = k(1) Or pbKey(6 - i)
k(2) = k(2) Or pbKey(10 - i)
k(3) = k(3) Or pbKey(14 - i)
Next i
Do While n > 0
z -= ((y << 4) Xor (y >> 5)) + y Xor (sum + k(sum >> 11 And 3))
sum -= delta
y -= ((z << 4) Xor (z >> 5)) + z Xor (sum + k(sum And 3))
n = n - 1
Loop
For i = 0 To 3
pbOut(i) = y
pbOut(i + 4) = z
y >>= 8
z >>= 8
Next i
End Function
|
|
|
|
|
You didn't initialize your byte-array-variable out(), resp. pbOut(). You just declared it in Button1_Click(..). Looks like you want to want to write to its indices 0 to 7, so you would have to initialize it like so:
Dim out As Byte() = New Byte(7) {}
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Many thanks Sascha!
From your answer I understand that by doing so I need to fix the dimension on the array.
From the original purpose, pbIn() and pBout() could have variable length...would there be a way to handle this?
SepPax
|
|
|
|
|
SepPax wrote: From your answer I understand that by doing so I need to fix the dimension on the array. Well, you need to initialize the variable for the array with an instance of an array. Array-variables are references and declaring them (e.g. Dim out As Byte() ) only yields a null-array-reference (or 'Nothing'-array-reference) that can but not yet has been assigned an actual array.
The 'dimension' is a different thing: You have declared a one-dimensional array here and there's (probably) nothing wrong with that. You might want to take a look at the MSDN page talking about arrays:
https://msdn.microsoft.com/en-us/library/wak0wfyt.aspx[^]
SepPax wrote: From the original purpose, pbIn() and pBout() could have variable length...would there be a way to handle this? That's the trouble with arrays: If you don't know beforehand how 'large' they have to be it get's a bit ugly, because they can't dynamically grow. Of course you could deal with that yourself but it's much more convenient to use a suitable collection-class then which will handle this for you. I guess a generic list would make sense in your case:
Dim out As New List(Of Byte)()
Please refer: List<T>[^]
SepPax wrote: Many thanks Sascha! You're welcome!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
got everything working as expected.
Thanks.
SepPax
|
|
|
|
|
cheers!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi,
I stored a file in my database table. The file is converted to binary, Now i want To retrieved the file back and save it to my selected location in my desktop.
Can anyone show me the code on how to do this. I am working on a form/windows based.
Thanks & Regards
--careLess
|
|
|
|
|
I dislike giving search results as an answer but did you even look at these results[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|