|
Well, it is quite simple and I did explain it before but let me try again. We have an instrument connected to the host PC. The software running on the PC needs to read EEPROM data held in the instrument. It sends a command to the instrument and the instrument responds by the sending the data. The software uses the FTDI DXXX library to read and write to the USB. The data is read byte by byte. The FTDI routine returns the data as a string. The software uses the Asc() function to get the value of each byte. It all works fine except in Win10 running the chinese version.
|
|
|
|
|
Of course ... I have read all you have written before.
The thing what isn't clear for me is : why don't you read the data by the emulated COM-Port from the FTDI-Device ?
I have had the same problem when I wanted to read the data from a RFID-Reader (and I solved it in that way).
|
|
|
|
|
Try using ASCW in stead of just plain ASC. ASC would be more for standard ASCII chars. Asc, AscW Functions[^]
|
|
|
|
|
Just curious why my answer got down voted when it was the first one and contained the information most other answers ?? -16 points not that I really care about points after all of these years here. Just Curious Why.
|
|
|
|
|
ledtech3 wrote: it was the first one
You do realise we can see the dates when the messages were posted, right?
Your answer was posted on 27th October at 3:45. And it's exactly the same suggestion and link as my answer[^], which was posted 25th October at 17:22 - more than a day earlier than yours.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yeah but when I posted originally there were no other comments or questions showing up at the time. That's the reason I said that. Otherwise I would not have posted anything. I went thru the link from the email notification of the question so not sure if that was the reason or not that nothing else showed up. Either way I give up trying to "Help People" because of so many "Trolls" here.
|
|
|
|
|
There were answers showing up in the forum more than 24 hours before you posted your answer. If you couldn't see them, then you need to report that as a bug:
Bugs and Suggestions[^]
You posted an answer that had already been posted more than a day previously, when the OP had already indicated that the answer did not help. It's hardly "trolling" for someone to down-vote your answer.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well there are 2 Down votes now but at least I know why now and that's all I was asking.
And I will report the bug.
Thank you for your time.
|
|
|
|
|
In my app I have the ability for users to attach files. These files can be anything such as Word documents, PDFs, images, Excel spreadsheets, etc. Is there a way to give the users the ability to print these files by clicking a single button? I was thinking that when you are in Windows Explorer and right click on a file one of the options is to print the selected file so there must be a way to call that type of functionality from code.
|
|
|
|
|
Assuming it's a desktop application, you can print a file by using Process.Start[^] with the "print" verb.
Dim psi As New ProcessStartInfo
psi.FileName = pathToTheFile
psi.Verb = "print"
Process.Start(psi)
NB: This requires that there is an application registered to print the file. Any file which shows "print" in the Windows Explorer context menu should work.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
This is a report program, in which I have to match filters to get a list of items.
So overall I'm missing some data that I need to find and see what it is.
I have this filter called states, in which the invoice shipping item has to match a state selected
For Each state As String In p.States
gInvoices_raw.AddRange(gInvoices_all.Where(Function(m) m.FSSTATE = state))
Next
In the loop, I need to find out what is left over, what remains, so I thought I would RemoveRange from gInvoices_all
But I don't have the slighest clue how to get the start and stop index of the Range to remove here
Or perhaps there is a better solution here.
gInvoices_all = gInvoices_all.OrderBy(Function(m) m.FSSTATE).ToList()
For Each state As String In p.States
gInvoices_raw.AddRange(gInvoices_all.Where(Function(m) m.FSSTATE = state))
gInvoices_all.RemoveRange(xxxxxxxxxxxxxxxxxxxxxxx)
Next
If it ain't broke don't fix it
|
|
|
|
|
Maybe I should just run this for now while I'm looking for missing sales
For Each state As String In p.States
Dim filteredInvoices As List(Of model_itemDistribution_Invoices) = gInvoices_all.Where(Function(m) m.FSSTATE = state).OrderBy(Function(m) m.FSHIPDATE).ToList()
gInvoices_raw.AddRange(filteredInvoices)
'Remove the Invoices just seleted from gInvoices_all
For Each invoice In filteredInvoices
gInvoices_all.Remove(invoice)
Next
Next
If it ain't broke don't fix it
|
|
|
|
|
Try:
gInvoices_raw.AddRange(gInvoices_all.Where(Function(m) m.FSSTATE = state))
gInvoices_all.RemoveAll(Function(m) m.FSSTATE = state)
List<T>.RemoveAll Method | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I thought RemoveAll would remove everything, I'll give it a try, Thanks!
If it ain't broke don't fix it
|
|
|
|
|
So I have this list of customer invoices that I need to just group into a list of
Customers
Customers by State,
Customers by City, or Street Address if there are multiple locations in a city
But on a small check, I got a duplicate, 2 customers in Tempe AZ with the same street address.
I did something wrong here but not sure what.
'Group all the Customers together from gInvoices_all
Dim gCustomers As List(Of model_itemDistribution_Invoices) = gInvoices_all.OrderBy(Function(ob) ob.FCUSTNO).GroupBy(Function(v) New With {Key v.FCUSTNO, Key v.FSSTATE, Key v.FSADDR1}).Select(Function(cl) New model_itemDistribution_Invoices() With {
.FCUSTNO = cl.First().FCUSTNO,
.FSSTATE = cl.First().FSSTATE,
.FSADDR1 = cl.First().FSADDR1,
.FCOMPANY = cl.First().FCOMPANY,
.FSALESPN = cl.First().FSALESPN,
.FCONTACT = cl.First().FCONTACT,
.FPHONE = cl.First().FPHONE,
.FSADDR2 = cl.First().FSADDR2,
.FSCITY = cl.First().FSCITY,
.FSZIPCODE = cl.First().FSZIPCODE,
.FSCOUNTRY = cl.First().FSCOUNTRY,
.FCSAMT = 0.0
}).ToList()
If it ain't broke don't fix it
|
|
|
|
|
At least one of the three columns you're grouping by will be different. Check for leading/trailing white-space, and if you're querying an in-memory collection, check the case of the values too.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'll do a trim, startswith or contains and see what happens
If it ain't broke don't fix it
|
|
|
|
|
jkirkerx wrote: But on a small check, I got a duplicate, 2 customers in Tempe AZ with the same street address. Do these two customers have the same FCUSTNO, or different ones? I'd assume that the street address is not the primary key, or even a unique value.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The duplicate has the same FCUSTNO, Same FSTATE, duplicate is the FADDR1
For now I ran the GroupBy twice and got a completly different result, less records but it looks correct.
If it ain't broke don't fix it
|
|
|
|
|
I've tried so many approaches... a simple "one-tier" JSON structure us easy, but when it comes to more complex objects, I cannot figure this out, despite help from various articles here and elsewhere (thought here aren't that many I've found.)
A typical structure I need to parse is like this:
{
"odata.metadata" : "blahblah",
"value" : [
{
"prop1" : 69,
"prop2" : 96,
"prop3" : "Blah",
"prop4" : "Blah",
"prop5" : [
{
"sub1" : 269,
"sub2" : 3,
"sub3" : "something",
"sub4" : null
}
],
"prop6" : []
},
{
"prop1" : 23,
"prop2" : 45,
"prop3" : "Blah2",
"prop4" : null,
"prop5" : [],
"prop6" : [
{
"sub1" : 169,
"sub2" : 7,
"sub3" : null,
"sub4" : "2017-10-01"
}
]
}
],
"odata.nextLink" : "blahblahURL"
}
They all have the same three top-level elements: "odata.metadata", "odata.nextLink" and "value", and it is only the "value" element that may differ - some will have more or fewer properties, but typically as above.
I start by defining a class:
Friend MustInherit Class Response
<JsonProperty("odata.metadata")>
Public MetaData As String
<JsonProperty("odata.nextLink")>
Public NextLink As String
End Class
Friend Class ClsTest
Inherits Response
<JsonProperty("value")>
Public Property TESTS() As Linq.JArray
End Class
I keep ClsTest separate as I may want to have different ones for different JSON structures, depending on what the final approach is....
then I can deserialize it in two different ways - if "json" is the string representing the object above:
1. using the class:
Dim cls As clsTest = JsonConvert.DeserializeObject(Of clsTest)(json)
2. or using a JObject
Dim jsonObject As Linq.JObject = JsonConvert.DeserializeObject(json)
but after each I can't get beyond extracting the "odata" values - I can't figure out how to get the "values" and read them into something I can work with in my application: - classes, lists arrays, whatever...
I realise this is still a rather general question and maybe not specific enough, but really any hints or help will be appreciated...
modified 15-Oct-17 7:53am.
|
|
|
|
|
bwah-ha - who needs help anyway! Woke up at 4 a.m. last night thinking "I could do it this way!" and lo and behold, it works! 
|
|
|
|
|
In my current (Windows Forms Application) project, I have a form which includes a number of DataGridViews, which are used to display tabular data for the user to look at and edit. The data sets are of known, fixed, size, and the DGVs are designed to allow the data sets to fit neatly within them. The ability to scroll the view (in any direction) is neither wanted nor needed.
I have disabled the scroll bars and set AllowUserToAddRows to false, but navigating down with the arrow keys still causes a blank row to appear at the bottom and the top row of data to disappear; arrowing all the way up reverses this. One odd aspect of this is that the scrolling up happens when you arrow down from the last but one to the last real row. If you use the mouse to select a cell in the last row and then try to arrow down, nothing happens.
There is what appears to be a fair amount of discussion of this problem in various places, but the solution generally given is to disable the scroll bars and set AllowUserToAddRows to false, which doesn't seem to work for me. I have also tried capturing the Scroll Event and repositioning the Selected Cell to the top of the DGV within it, which sort of works, but this has other unwanted side-effects. Has anyone else run into this problem and/or come up with a good solution?
|
|
|
|
|
After spending a lot of time researching this, I was able to come up with a solution which works, but there should be an easier way! There are a lot of 'gotchas', apparently 'baked in' to the design of the control. Not only does the view scroll up (by default) when you arrow down into a cell in the last row, but it also scrolls up if you arrow left or right while in the last row.
Implementing my solution involves a number of steps:
1) Subclass the DataGridView control so that you can (optionally) override its ProcessCmdKey method to disable special handling of the arrow keys (you don't actually need to mess with the up arrow key, but I found it easier to disable all of them.
2) Substitute references to your new MyDataGridView control for those to the original version in the containing Form's Designer.vb file - for me, using VS 2013, two references needed to be changed for each affected control. Then, either in the designer or in initialization code, set the option to disable the arrow keys for the modified controls.
3) Write code for the KeyUp and KeyDown Events for each affected control - the KeyDown code does apparently need to be there, but it only has to set the Handled event argument to True; the KeyUp code has to do the work of changing the current cell appropriately for the arrow key pressed. For any arrow keystroke that results in a move to a cell in the bottom row (including a lateral one), the KeyUp code also has to set the control's FirstDisplayedScrollingRowIndex Property to 0 after implementing the move. This is what scrolls the view back down again to abolish the empty row, but it does cause a visible 'glitch'.
4) If you don't want the view to appear to 'glitch' when the user is moving to or on the bottom row, it is best to surround the working KeyUp code with calls to disable and re-enable screen painting while it is (in effect) moving the focus about.
|
|
|
|
|
My question is about that I want to change this demo's menustrip's font? How can I change? https://www.codeproject.com/Articles/18429/An-XML-Driven-Menu-Strip
Thank you for helping!!! 
|
|
|
|
|