Click here to Skip to main content
15,905,144 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVB.NET Pin
Babayomi28-Apr-20 12:07
Babayomi28-Apr-20 12:07 
GeneralRe: VB.NET Pin
Ralf Meier28-Apr-20 20:01
mveRalf Meier28-Apr-20 20:01 
AnswerRe: VB.NET Pin
Richard MacCutchan28-Apr-20 21:44
mveRichard MacCutchan28-Apr-20 21:44 
QuestionCompare File Date Created Date Modified in VBA ( Allow Download time 20 mintes Buffer Time) Pin
Member 1478441625-Apr-20 3:27
Member 1478441625-Apr-20 3:27 
AnswerRe: Compare File Date Created Date Modified in VBA ( Allow Download time 20 mintes Buffer Time) Pin
Richard MacCutchan25-Apr-20 4:14
mveRichard MacCutchan25-Apr-20 4:14 
QuestionBinding Navigator Movement Event Error Pin
Member 1480975421-Apr-20 23:23
Member 1480975421-Apr-20 23:23 
AnswerRe: Binding Navigator Movement Event Error Pin
Gerry Schmitz22-Apr-20 9:14
mveGerry Schmitz22-Apr-20 9:14 
GeneralRe: Binding Navigator Movement Event Error Pin
Member 1480975422-Apr-20 23:16
Member 1480975422-Apr-20 23:16 
GeneralRe: Binding Navigator Movement Event Error Pin
Mycroft Holmes23-Apr-20 11:16
professionalMycroft Holmes23-Apr-20 11:16 
QuestionLogoff or disconnect system account session at Ctrl + Alt + Delete screen Pin
Member 146239898-Apr-20 17:20
Member 146239898-Apr-20 17:20 
AnswerRe: Logoff or disconnect system account session at Ctrl + Alt + Delete screen Pin
Member 1462398914-Apr-20 9:23
Member 1462398914-Apr-20 9:23 
QuestionVisual Basic "originated from an internet" EXCEL Pin
raeyoung7-Apr-20 4:18
raeyoung7-Apr-20 4:18 
QuestionRe: Visual Basic "originated from an internet" EXCEL Pin
Richard MacCutchan7-Apr-20 4:50
mveRichard MacCutchan7-Apr-20 4:50 
AnswerRe: Visual Basic "originated from an internet" EXCEL Pin
raeyoung7-Apr-20 7:22
raeyoung7-Apr-20 7:22 
GeneralRe: Visual Basic "originated from an internet" EXCEL Pin
Richard MacCutchan7-Apr-20 7:59
mveRichard MacCutchan7-Apr-20 7:59 
GeneralRe: Visual Basic "originated from an internet" EXCEL Pin
raeyoung7-Apr-20 8:07
raeyoung7-Apr-20 8:07 
GeneralRe: Visual Basic "originated from an internet" EXCEL Pin
Richard MacCutchan7-Apr-20 9:12
mveRichard MacCutchan7-Apr-20 9:12 
AnswerRe: Visual Basic "originated from an internet" EXCEL Pin
Mycroft Holmes7-Apr-20 11:15
professionalMycroft Holmes7-Apr-20 11:15 
QuestionInstall a VB Net application to install a sql database on other computers Pin
Member 147798703-Apr-20 12:41
Member 147798703-Apr-20 12:41 
AnswerRe: Install a VB Net application to install a sql database on other computers Pin
Dave Kreskowiak3-Apr-20 14:12
mveDave Kreskowiak3-Apr-20 14:12 
AnswerRe: Install a VB Net application to install a sql database on other computers Pin
evry1falls6-May-20 9:22
evry1falls6-May-20 9:22 
QuestionLinq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx3-Apr-20 7:48
professionaljkirkerx3-Apr-20 7:48 
I feel like I painted myself into a corner here. But hopeful Linq was well designed to pull this off. I don't even know what to call it to look it up on the internet.

So I have a List of Items sold for the year, and each item has a cost, price, qty, invoice number, shipdate.
My objective is to group those items by invoice number. But as I group, I need to do the following ...

Say invoice 1000 has 5 items for example.
For each item assigned to invoice 1000,
I need ....
FExtCost = (FSHIPQTY * FCOST)<br />
fExtPrice = (FSHIPQTY * FPRICE)

What I have so far is the remnants of my design mistake, when I realized my numbers were wrong after fact checking the report. Like I just need the first instance of the inv number, first instance of a item description, but to total the cost, price so I can calculate the margin of the invoice.

Yes I'm asking for help writing code. Or a link to some examples I can study.
Dim gInvoicesAll As List(Of MarginCustomerInvoicesR1) = cTpAll.OrderBy(Function(ob) ob.FINVNO).GroupBy(Function(inv) inv.FINVNO).Select(Function(cl) New MarginCustomerInvoicesR1() With {
    .FCustNo = cl.First().FCUSTNO,
    .FInvNo = cl.First().FINVNO,
    .FShipDate = cl.First().FSHIPDATE,
    .FDescript = cl.First().FDESCRIPT,    
    .FAmount = cl.Sum(Function(priceTotal) priceTotal.FAMOUNT),
    .FExtCost = 0,
    .FExtPrice = 0,
    .FExtMargin = 0,
    .FPercent = 0
}).ToList()

Along time ago, Richard gave me a sophistacated solution for price, so I tried to build on it
.FPriceMin = cl.OrderByDescending(Function(i) If(i.FPrice = 0, 0, 1)).ThenByDescending(Function(i) i.FShipDate).First().FPrice,
If it ain't broke don't fix it
Discover my world at jkirkerx.com


modified 3-Apr-20 14:21pm.

AnswerRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx3-Apr-20 8:51
professionaljkirkerx3-Apr-20 8:51 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
Richard Deeming6-Apr-20 1:19
mveRichard Deeming6-Apr-20 1:19 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx6-Apr-20 7:28
professionaljkirkerx6-Apr-20 7:28 

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.