|
I have this XLS Sheet to create, or a report that groups sales by states and by customers.
Some of the customers have multiple locations in states, and have different customer names but it' the same customer.
EG.
ABC Company (Ontario)
ABC Company (Anaheim)
ABC Company *
(San Jose) ABC Company
I'm not even sure what to call this so I can search the internet.
Nor where to even start on this.
But this is my final GroupBy Call before I send it to the XLS creator.
Dim gCustomersItems_Final As List(Of model_itemDistribution_Items) = gCustomer_items.OrderBy(Function(ob) ob.FSSTATE).ThenBy(Function(tb) tb.FCOMPANY).GroupBy(Function(v) New With {Key v.FCOMPANY, Key v.FSSTATE}).Select(Function(cl) New model_itemDistribution_Items() With {
.FSADDR1 = cl.First().FSADDR1,
.FITEMNO = cl.First().FITEMNO,
.FDESCRIPT = cl.First().FDESCRIPT,
.FSHIPQTY = cl.Sum(Function(qty) qty.FSHIPQTY),
.FCSAMT = cl.Sum(Function(amount) amount.FCSAMT),
.FSCITY = cl.First().FSCITY,
.FSSTATE = cl.First().FSSTATE,
.FSZIPCODE = cl.First().FSZIPCODE,
.FSCOUNTRY = cl.First().FSCOUNTRY,
.FCUSTNO = cl.First().FCUSTNO,
.FCOMPANY = cl.First().FCOMPANY,
.FSALESPN = cl.First().FSALESPN,
.FMAXDATE = cl.Max(Function(m) m.FSHIPDATE)
}).ToList()
If it ain't broke don't fix it
|
|
|
|
|
The problem is that the database is badly designed, the Customer table needs a grouping field that is common to all the branch records, you need a company table with a foreign key to your customer table so you can group them.
I will be astonished if you can cater for all the garbage in that users can type for a company name. You should never rely on user input for key values (grouping makes it a key value).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Your right. There is so much garbage in the database from all the users with half a brain that entered customers.
I tried the Levenstein and it came close to extracting but it takes too long to test and adjust the integer.
Now I'm just going to try and manually change the names first based on a static list and then run the function.
If it ain't broke don't fix it
|
|
|
|
|
Surely the static list would be better used as a Company table content and linking ot to the customer table. It will require a change to the UI to support the Company. Not trivial but will make your life a lot simpler down the track.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
not able find error
addn:
If h = 1 Then lr = Range("GTB").Rows.Count + 9
If h = 2 Then lr = Range("NGTB").Rows.Count + 9
Set Gcell = wb.Sheets(InputSheet).Cells.Find(GetVal(CStr(Area(x, j))))
GCA = Gcell.Address(ReferenceStyle:=xlA1, _
RowAbsolute:=False, ColumnAbsolute:=False)
Range("B" & lr).Value = i
Range("C" & lr).Value = "01-" + headers(1, j) + "-" + Year
'Range("D" & lr).Value = i
Range("G" & lr).Value = Area(x, 15)
Range("H" & lr).Value = Area(x, 16)
Range("I" & lr).Value = Area(x, 14)
Range("E" & lr).Value = Area(x, 17)
Range("J" & lr).Value = Now()
wb.Sheets(InputSheet).Range(GCA).Copy Range("D" & lr)
Range("D" & lr).Font.Size = 9
Range("D" & lr).Font.Name = "Calibri"
End If
nxtc:
Next j
Next x
Erase Area, headers
nw:
Next i
Next h
Del Worksheets("GTB AUDIT"), "GTB", wb
Del Worksheets("NOT GTB AUDIT"), "NGTB", wb
Ordering
FormatGTB Sects
FormatNGTB Sects
wb.Close False
Application.ScreenUpdating = True
'ActiveCell.MergeArea.Rows.Count
End Sub
|
|
|
|
|
actually error line is :
l Worksheets("GTB AUDIT"), "GTB", wb
|
|
|
|
|
Del Worksheets("GTB AUDIT"), "GTB", wb
|
|
|
|
|
Error 9 is "Subscript out of range".
Try to find out on which line the error occured and check the (array) indexes used on that line.
We can't really help because we don't kow where the error occurs. Even then we would probably not know the allowed ranges for indexes used on that line because your code snippet is incomplete (EndIf without matching If , labels that are never targeted, and loop variable increments without the loop start and stop statements).
[EDIT]
And another tip:
Instead of posting new messages to fix errors in previous ones or add more information, you should edit your existing one like I have done here. There is an 'Edit' link on the bottom of each of your messages.
[/EDIT]
|
|
|
|
|
Hi guys! How are you all doing?
I'm new to this forum, just started working in VB .Net and I'm now starting my first project.
I ran into a little snag today, spent quiet a bit of time trying to fix it but you can't fix something if you don't understand what's going on, right?
So two things - can someone explain why I'm getting the error In the attached screen shot and how do I fix it?
Additional info:
Intellisense is suggesting that I generate a constructor sub in frm_reportviewer1 but when I do I get some more errors saying "reference to a non-shared member requires an object reference" (I get this when I say frm_reportviewer.show()
Any assistance is appreciated.
Thanks!
[IMG]https://uploads.tapatalk-cdn.com/20171108/e3f28c9691a422dd78d7a84def68f5e7.jpg[/IMG]
|
|
|
|
|
A genuine screenshot
frm_reportviewer1 is basically a special class, and to create a new instance of a class you generally so something like:
class frm_reportviewer1
sub new()
end sub
sub new(byval Object as MyClass)
end sub
end class
In your code you lack the method overload to send your Object witch I called MyClass.
|
|
|
|
|
Data source configuration wizard, choose database objects, click tables, click finish to configure the dataset - get this message "Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information". I have a split access database and am pointing to the back end where the tables are and in the correct folder. VS configuration wizard finds the Access database back end and the table names which it has.
I am SO STUCK. When I put code inside the form to open the connection all I am able to know is that the table itself is where the bounded area is on the form but no information details from the access table. The VS form does show the correct number of records that the main table has, which strikes me as odd to know how many records are in the table but not be able to grab the individual fields in the table.
Any help would be greatly appreciated!
|
|
|
|
|
I would suspect you can't use Linked Tables in Access with the tools in Visual Studio. I don't use Access for anything anymore, so I can't test this theory.
My guess would be that you have to go directly to the underlying database, NOT ACCESS, for this to work.
|
|
|
|
|
ANY VB 6 CODE FOR AN .EML FILE ARCHIVE WITH VIEWER.
|
|
|
|
|
1) DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
2) It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to Freelancer.com and ask there.
But be aware: you get what you pay for. Pay peanuts, get monkeys.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
So either pay someone to do it, or learn how to write it yourself. We aren't here to do it for you.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
How vb.net upload image on mysql using php?
Thanks for you answer.
|
|
|
|
|
You use VB or PHP, not both. How would you imagine that to work?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You're going to have to go into a lot more detail than that.
Are you talking about uploading a file to a website? Is your client this VB.NET app? Is the website written in VB.NET? Or what's the setup here?
What type of apps are running where and written in what?
|
|
|
|
|
Hi there. Simple question or so I hope. I have two forms. Form1 is showing a directshow video stream. The second, form2, overlaid, is basically a splashscreen, adobe photoshop style, with transparency. Both forms work fine. HOWEVER, the transparency is only rendered for the first frame as form2 is displayed. Then, as the video changes behind it, the form2 region is not updated (ie the transparent bits remain what was on the screen when it was first drawn, almost as if it was a screen grab)
I am assuming it is because the OnPaintBackground sub which paints the transparent form is only called once, as the form loads. So how can I keep it updating so that the actual live video shows thru the transparent bits? This is what I have :
Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
Dim gfx As dra.Graphics = pevent.Graphics
Dim IMA As Image
IMA = Image.FromFile("D:\WORK\myfile.png", True)
gfx.DrawImage(IMA, New dra.Rectangle(0, 0, Me.Width, Me.Height))
End Sub
|
|
|
|
|
You can't do it using a transparent form. The form overlaying the video is a control that is never repainted, which has to be done ON EVERY FRAME OF VIDEO.
You have no way of getting that notification and, frankly, in Windows Forms, the performance hit is ridiculous and won't be able to keep up with the video.
The proper way to do this would be a filter that draws the overlay in the graph that is loading, decoding, mixing, and rendering the video/audio. There may be libraries out there that make this easier, like possibly Overlay.NET.
I've never used any of them, so don't ask.
|
|
|
|
|
I want to preview the cursor file when I click a button or something, after the user gives the path of the .cur file, does anyone know how to?
|
|
|
|
|
|
I tried renaming it to a .ico file but it didn't work, I just want to convert it to an image to get a preview of it.
|
|
|
|
|
How exactly do you think changing the extension on a file name will affect the content? Follow the link I provided and see what you need to do to read a cursor file and interpret (and display) its content. .NET even contains a class to do most of the work for you: Cursor Class (System.Windows.Forms)[^].
|
|
|
|
|
Thank you I'll refer to it! But I tried to load a cursor file using these methods, it didn't give any errors but at runtime it says that the cursor file is damaged. I even tried system cursor files! I just want to give a preview of the cursor to the user, changing the mouse pointer is enough, don't need to view a preview on a picture box.
|
|
|
|