Click here to Skip to main content
15,881,852 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
AnswerRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx3-Apr-20 8:51
professionaljkirkerx3-Apr-20 8:51 
Perhaps the answer is to just perform the calc after the grouping.
Group the Invoices, then loop them, and do another linq to go back to the original and grab the items.
'Use Linq to Group the Invoices Together
                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(sum) sum.FAMOUNT),
    .FExtCost = 0,
    .FExtPrice = 0,
    .FExtMargin = 0,
    .FPercent = 0
}).ToList()

Dim rsDataRow As DataRow
For Each pI As MarginCustomerInvoicesR1 In gInvoicesAll

  'Instead of using Linq, I'll just iterate the original data before grouping
  Dim items = cTpAll.Where(Function(item) item.FINVNO.Equals(pI.FInvNo)).ToList()
  For Each item In items
    pI.FExtCost += If(item.FCOST <> 0 And item.FSHIPQTY <> 0, item.FCOST * item.FSHIPQTY, 0)
    pI.FExtPrice += If(item.FPRICE <> 0 And item.FSHIPQTY <> 0, item.FPRICE * item.FSHIPQTY, 0)
    pI.FExtMargin += pI.FExtPrice - pI.FExtCost
  Next
If it ain't broke don't fix it
Discover my world at jkirkerx.com

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 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
Richard Deeming6-Apr-20 8:01
mveRichard Deeming6-Apr-20 8:01 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx6-Apr-20 9:20
professionaljkirkerx6-Apr-20 9:20 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
Richard Deeming7-Apr-20 0:30
mveRichard Deeming7-Apr-20 0:30 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx7-Apr-20 7:05
professionaljkirkerx7-Apr-20 7:05 
GeneralRe: Linq GroupBy Invoice Number, iterate all items before group Pin
jkirkerx8-Apr-20 9:24
professionaljkirkerx8-Apr-20 9:24 
QuestionHow to update sql server data from excel data using VBA code by all User Pin
Member 1478441627-Mar-20 0:25
Member 1478441627-Mar-20 0:25 
AnswerRe: How to update sql server data from excel data using VBA code by all User Pin
ZurdoDev27-Mar-20 1:19
professionalZurdoDev27-Mar-20 1:19 
GeneralRe: How to update sql server data from excel data using VBA code by all User Pin
Member 1478441627-Mar-20 2:17
Member 1478441627-Mar-20 2:17 
Questionevent handler Pin
Member 1356965021-Mar-20 23:16
Member 1356965021-Mar-20 23:16 
AnswerRe: event handler Pin
Richard MacCutchan21-Mar-20 23:31
mveRichard MacCutchan21-Mar-20 23:31 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 0:24
Member 1356965022-Mar-20 0:24 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 0:33
mveRichard MacCutchan22-Mar-20 0:33 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 1:04
Member 1356965022-Mar-20 1:04 
GeneralRe: event handler Pin
Richard MacCutchan22-Mar-20 4:03
mveRichard MacCutchan22-Mar-20 4:03 
GeneralRe: event handler Pin
Member 1356965022-Mar-20 4:18
Member 1356965022-Mar-20 4:18 

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.