Click here to Skip to main content
15,885,757 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to perform non-case search in DataGridViewComboBoxColumn Pin
mo14924-Sep-19 4:58
mo14924-Sep-19 4:58 
GeneralRe: How to perform non-case search in DataGridViewComboBoxColumn Pin
CHill605-Sep-19 0:02
mveCHill605-Sep-19 0:02 
GeneralRe: How to perform non-case search in DataGridViewComboBoxColumn Pin
mo14925-Sep-19 5:42
mo14925-Sep-19 5:42 
QuestionLinq, GroupBy, Select, First() or Last() Pin
jkirkerx28-Aug-19 12:38
professionaljkirkerx28-Aug-19 12:38 
AnswerRe: Linq, GroupBy, Select, First() or Last() Pin
Maciej Los28-Aug-19 21:24
mveMaciej Los28-Aug-19 21:24 
GeneralRe: Linq, GroupBy, Select, First() or Last() Pin
jkirkerx29-Aug-19 6:59
professionaljkirkerx29-Aug-19 6:59 
AnswerRe: Linq, GroupBy, Select, First() or Last() Pin
Richard Deeming29-Aug-19 7:14
mveRichard Deeming29-Aug-19 7:14 
GeneralRe: Linq, GroupBy, Select, First() or Last() Pin
jkirkerx29-Aug-19 8:32
professionaljkirkerx29-Aug-19 8:32 
First and Last was a tough choice so I chose first for customer and part number and last for cost and price.
Maybe not the best decision and I knew inflation or supply and demand was a factor when I first wrote it.
When I think about it, it probably doesn't matter if the part number is always the same.

But I didn't see the free item after the paid item coming and missed the thought of it occurring.

On a side note mentioned by Maciej on the OrderBy, Guess I should of used the ShipDate for that, for a true first or last. What do you think?

The code runs and free items have been removed from the report now, which is what I wanted and tried to do in code elsewhere. Not sure if I need this line .FShipDate = cl.Last().FShipDate,

If I could make this better, I'd be open to suggestions. The FCost and FPrice bothers me because they fluctuate. Thought about using average but I'm not sure how to implement it.
'Use Linq to Group the Items Together
Dim gCustomersAll As List(Of MarginItemCustomerProfit) = sTpAll.GroupBy(Function(item) item.FCustomerNo).Select(Function(cl) New MarginItemCustomerProfit() With {
    .FCustomerNumber = cl.First().FCustomerNo,
    .FItemNumber = cl.First().FItemNo,
    .FShipQty = cl.Sum(Function(qty) qty.FShipQty),
    .FShipDate = cl.Last().FShipDate, // Not sure if I need this line
    .FCost = cl.Max(Function(cost) cost.FCost),
    .FPrice = cl.OrderByDescending(Function(i) If(i.FPrice = 0, 0, 1)).ThenByDescending(Function(i) i.FShipDate).First().FPrice,
    .FAmount = cl.Sum(Function(amount) amount.FAmount)
}).ToList()
If it ain't broke don't fix it
Discover my world at jkirkerx.com


modified 29-Aug-19 14:42pm.

QuestionTrying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Augusto10026-Aug-19 6:51
Augusto10026-Aug-19 6:51 
AnswerRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
ZurdoDev26-Aug-19 7:38
professionalZurdoDev26-Aug-19 7:38 
AnswerRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Richard Deeming27-Aug-19 2:55
mveRichard Deeming27-Aug-19 2:55 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Augusto10027-Aug-19 5:36
Augusto10027-Aug-19 5:36 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Richard Deeming27-Aug-19 5:40
mveRichard Deeming27-Aug-19 5:40 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Augusto10027-Aug-19 6:23
Augusto10027-Aug-19 6:23 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Richard Deeming27-Aug-19 6:30
mveRichard Deeming27-Aug-19 6:30 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Augusto10027-Aug-19 6:36
Augusto10027-Aug-19 6:36 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Richard Deeming27-Aug-19 7:07
mveRichard Deeming27-Aug-19 7:07 
GeneralRe: Trying to make a fixed asset program using visual studio and sql server I got a conversion error varchar to numeric Pin
Mycroft Holmes27-Aug-19 15:14
professionalMycroft Holmes27-Aug-19 15:14 
QuestionCount the number of database hit were made Pin
desanti24-Aug-19 12:37
desanti24-Aug-19 12:37 
AnswerRe: Count the number of database hit were made Pin
Gerry Schmitz25-Aug-19 2:30
mveGerry Schmitz25-Aug-19 2:30 
GeneralRe: Count the number of database hit were made Pin
desanti25-Aug-19 3:49
desanti25-Aug-19 3:49 
GeneralRe: Count the number of database hit were made Pin
Gerry Schmitz25-Aug-19 11:38
mveGerry Schmitz25-Aug-19 11:38 
GeneralRe: Count the number of database hit were made Pin
desanti25-Aug-19 15:07
desanti25-Aug-19 15:07 
AnswerRe: Count the number of database hit were made Pin
Mycroft Holmes26-Aug-19 12:14
professionalMycroft Holmes26-Aug-19 12:14 
GeneralRe: Count the number of database hit were made Pin
desanti26-Aug-19 13:41
desanti26-Aug-19 13:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.