|
Hello all.
Does anyone know how to send multiple latitudes & longitudes from VB.net to Google Maps and receive from Maps services what is the best route?
I'd like to receive something like this:
1) Address B
2) Address A
3) Address D
4) Address C
It would indicate me where to go first.
Thanks.
Paulo
|
|
|
|
|
Ah the old drunkards walk - I designed one of these in the 90s, for just one city. I'm betting Google does not have such a facility freely available, it is a MAJOR task to get right as you must take into account one way street and traffic conditions.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
The API accepts multiple addresses, and returns the results in the form of arrays. The actual format to be used will depend on which version (iOS, Android, JSON) that you are using. The Google documentation should help.
|
|
|
|
|
I posted this C# board first which was a mistake again I apologize. I work for this company where the old programmer was in the process of rewrite the source code with no documentation at all from VB.Net to C# Now we have 4 programs total and they all update from the same database and get price updates on items. My problem is on one of the programs if a customer was to do full sync which is the whole database list of well 60,000 items I get OutOfMemoryException when it imports the last category Items. Here are the Exceptions Quote: Exception thrown: 'System.OutOfMemoryException' in System.Data.dll
Exception thrown: 'System.OutOfMemoryException' in Microsoft.EntityFrameworkCore.Relational.dll
Exception thrown: 'System.OutOfMemoryException' in Microsoft.EntityFrameworkCore.Relational.dll
Exception thrown: 'System.OutOfMemoryException' in Microsoft.EntityFrameworkCore.dll
Exception thrown: 'System.OutOfMemoryException' in Microsoft.EntityFrameworkCore.dll
Private Function DoImpItems() As Boolean
Dim percent As Integer = 0
Dim currentRow As Integer = 0
Dim ItemDataRow As DataSetPricing.ItemsRow
Dim CommodityDataRow As DataSetPricing.CommoditiesRow
Dim LevelTypeDataRow As DataSetPricing.LevelTypesRow
Dim StatusDataRow As DataSetPricing.StatusRow
Dim ManufacturerDataRow As DataSetPricing.ManufacturersRow
Dim UomDataRow As DataSetPricing.UOMRow
Dim WorkgroupDataRow As DataSetPricing.WorkGroupsRow
Dim Item As Models.Item
Manufacturers = ServiceLocator.Current.GetInstance(Of IManufacturers).Get
WorkGroups = ServiceLocator.Current.GetInstance(Of IWorkgroups).Get
LevelTypes = ServiceLocator.Current.GetInstance(Of ILevelTypes).Get
ItemStatus = ServiceLocator.Current.GetInstance(Of IItemStatusTypes).Get
UOM = ServiceLocator.Current.GetInstance(Of IUom).Get
'Update Existing Items
Try
currentRow = 0
For Each row In DataSetPricing.Items
Item = ServiceLocator.Current.GetInstance(Of IItems).GetByRowId(row.RowID)
If Not Item Is Nothing Then
If Not Item.DoNotUpdate Then
Item.EriNumber = row.ERINumber
Item.EriNumberSearch = row.ERINumber
Item.Comparative = row.Comparative
If row.ParentID <> 0 Then
ItemDataRow = DataSetPricing.Items.Where(Function(d) d.PK_ItemID = row.ParentID).SingleOrDefault
If Not ItemDataRow Is Nothing Then
Dim ItemParent As Models.Item = ServiceLocator.Current.GetInstance(Of IItems).GetByRowId(ItemDataRow.RowID)
If Not ItemParent Is Nothing Then
Item.ParentId = ItemParent.PkItems
Else
Item.ParentId = 0
End If
Else
Item.ParentId = 0
End If
Else
Item.ParentId = 0
End If
Item.CatalogNumber = row.CatalogNumber
Item.Description = row.Description
Item.MyCost = CDec(Math.Round(row.Cost * IIf(IsDBNull(Item.MyMultiplier), 1, Item.MyMultiplier), 2))
Item.Cost = row.Cost
Item.Retail = row.Retail
If Not Config.NoUpdateLabor Then
Item.Labor = row.Labor
End If
Item.EffectiveDate = row.DateEffective
Item.Comparative = row.Comparative
Item.UPC = Strings.Right(row.UPC, 5)
Item.AlphaIndex = row.AlphaIndex
Item.ReportGroup = row.ReportGroup
Item.ImKing = row.ImKing
Item.ImageUrl = IIf(IsDBNull(row.ImageURL), String.Empty, row.ImageURL)
Item.CatalogPageUrl = IIf(IsDBNull(row.CatalogPageURL), String.Empty, row.CatalogPageURL)
Item.LastCostUpdate = Date.Now
LevelTypeDataRow = DataSetPricing.LevelTypes.Where(Function(d) d.PK_LevelTypeID = row.FK_LevelTypeID).SingleOrDefault
If Not LevelTypeDataRow Is Nothing Then
Dim q = (From c In LevelTypes Where c.RowId = LevelTypeDataRow.RowID).SingleOrDefault
Item.FkLevel = q.LevelTypeId
Else
Item.FkLevel = 1
End If
StatusDataRow = DataSetPricing.Status.Where(Function(d) d.PK_StatusID = row.FK_StatusID).SingleOrDefault
If Not StatusDataRow Is Nothing Then
Dim q = (From c In ItemStatus Where c.Status = StatusDataRow.Description).SingleOrDefault
Item.FkStatus = q.PkItemStatusTypes
Else
Item.FkStatus = 1
End If
UomDataRow = DataSetPricing.UOM.Where(Function(d) d.PK_UOMID = row.FK_UOMID).SingleOrDefault
If Not UomDataRow Is Nothing Then
Dim q = (From c In UOM Where c.UOM = UomDataRow.ShortDescription).SingleOrDefault
Item.FkUom = q.IdUom
Else
Item.FkUom = 0
End If
WorkgroupDataRow = DataSetPricing.WorkGroups.Where(Function(d) d.PK_WorkGroupID = row.FK_WorkgroupID).SingleOrDefault
If Not WorkgroupDataRow Is Nothing Then
Dim q = (From c In WorkGroups Where c.RowId = WorkgroupDataRow.RowID).SingleOrDefault
Item.FkWorkgroup = q.PkWorkgroups
Else
Item.FkWorkgroup = 0
End If
CommodityDataRow = DataSetPricing.Commodities.Where(Function(d) d.PK_CommodityID = row.FK_CommodityID).SingleOrDefault
If Not CommodityDataRow Is Nothing Then
Dim q = ServiceLocator.Current.GetInstance(Of ICommodities).GetByRowId(CommodityDataRow.RowID)
Item.FkCommodityId = q.PkCommodityId
Else
Item.FkCommodityId = 0
End If
ManufacturerDataRow = DataSetPricing.Manufacturers.Where(Function(d) d.PK_ManufacturerID = row.FK_ManufacturerID).SingleOrDefault
If Not ManufacturerDataRow Is Nothing Then
Dim q = (From c In Manufacturers Where c.RowId = ManufacturerDataRow.RowID).FirstOrDefault
Item.FkManufacturer = q.PkManufacturerId
Else
Item.FkManufacturer = 0
End If
End If
ServiceLocator.Current.GetInstance(Of IItems).Update(Item)
Else
Dim entity As New Models.Item
entity.EriNumber = row.ERINumber
entity.EriNumberSearch = row.ERINumber
entity.CatalogNumber = row.CatalogNumber
entity.Description = row.Description
entity.MyCost = row.Cost
entity.Cost = row.Cost
entity.Retail = row.Retail
entity.Labor = row.Labor
entity.EffectiveDate = row.DateEffective
entity.Comparative = row.Comparative
entity.UPC = Strings.Right(CStr(row.UPC), 5)
entity.AlphaIndex = row.AlphaIndex
entity.ReportGroup = row.ReportGroup
entity.ImKing = row.ImKing
entity.MyMultiplier = 1
entity.RowId = row.RowID
entity.ImageUrl = row.ImageURL
entity.CatalogPageUrl = row.CatalogPageURL
entity.LastCostUpdate = Date.Now
entity.DefaultCostCode = 0
If row.ParentID <> 0 Then
ItemDataRow = DataSetPricing.Items.Where(Function(d) d.PK_ItemID = row.ParentID).SingleOrDefault
If Not ItemDataRow Is Nothing Then
Dim ItemParent As Models.Item = ServiceLocator.Current.GetInstance(Of IItems).GetByRowId(ItemDataRow.RowID)
If Not ItemParent Is Nothing Then
entity.ParentId = ItemParent.PkItems
Else
entity.ParentId = 0
End If
Else
entity.ParentId = 0
End If
Else
entity.ParentId = 0
End If
LevelTypeDataRow = DataSetPricing.LevelTypes.Where(Function(d) d.PK_LevelTypeID = row.FK_LevelTypeID).SingleOrDefault
If Not LevelTypeDataRow Is Nothing Then
Dim q = (From c In LevelTypes Where c.RowId = LevelTypeDataRow.RowID).SingleOrDefault
entity.FkLevel = q.LevelTypeId
Else
entity.FkLevel = 1
End If
StatusDataRow = DataSetPricing.Status.Where(Function(d) d.PK_StatusID = row.FK_StatusID).SingleOrDefault
If Not StatusDataRow Is Nothing Then
Dim q = (From c In ItemStatus Where c.Status = StatusDataRow.Description).SingleOrDefault
entity.FkStatus = q.PkItemStatusTypes
Else
entity.FkStatus = 1
End If
UomDataRow = DataSetPricing.UOM.Where(Function(d) d.PK_UOMID = row.FK_UOMID).SingleOrDefault
If Not UomDataRow Is Nothing Then
Dim q = (From c In UOM Where c.UOM = UomDataRow.ShortDescription).SingleOrDefault
entity.FkUom = q.IdUom
Else
entity.FkUom = 0
End If
WorkgroupDataRow = DataSetPricing.WorkGroups.Where(Function(d) d.PK_WorkGroupID = row.FK_WorkgroupID).SingleOrDefault
If Not WorkgroupDataRow Is Nothing Then
Dim q = (From c In WorkGroups Where c.RowId = WorkgroupDataRow.RowID).SingleOrDefault
entity.FkWorkgroup = q.PkWorkgroups
Else
entity.FkWorkgroup = 0
End If
CommodityDataRow = DataSetPricing.Commodities.Where(Function(d) d.PK_CommodityID = row.FK_CommodityID).SingleOrDefault
If Not CommodityDataRow Is Nothing Then
Dim q = ServiceLocator.Current.GetInstance(Of ICommodities).GetByRowId(CommodityDataRow.RowID)
entity.FkCommodityId = q.PkCommodityId
Else
entity.FkCommodityId = 0
End If
ManufacturerDataRow = DataSetPricing.Manufacturers.Where(Function(d) d.PK_ManufacturerID = row.FK_ManufacturerID).SingleOrDefault
If Not ManufacturerDataRow Is Nothing Then
Dim q = (From c In Manufacturers Where c.RowId = ManufacturerDataRow.RowID).FirstOrDefault
entity.FkManufacturer = q.PkManufacturerId
Else
entity.FkManufacturer = 0
End If
ServiceLocator.Current.GetInstance(Of IItems).Add(entity)
End If
currentRow += 1
percent = CInt((currentRow / DataSetPricing.Items.Rows.Count) * 100)
BackgroundWorker.ReportProgress(percent)
Next
Catch ex As Exception
secondLevelMsg = ex.Message
Return False
Exit Function
End Try
Return True
End Function
|
|
|
|
|
Looks to me "it" is reading, updating and creating (Entity Framework) entities; but nowhere is it writing ("flushing") these entities to a database or garbage collecting. So, "memory" just fills up.
This may work for a few items (for whatever purpose), but not apparently for "60,000" (at one time).
For Each row In DataSetPricing.Items
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
What about using
XStreamingElement When reading the file
DataSetPricing.Items.BeginLoadData()
DataSetPricing.Items.DataSet.ReadXml(String.Format("{0}\Items.xml", My.Computer.FileSystem.SpecialDirectories.Temp), XmlReadMode.InferTypedSchema)
DataSetPricing.Items.EndLoadData()
BackgroundWorker.ReportProgress(60)
How do I change the code?
|
|
|
|
|
I'm trying to read an xml file one line at a time to update someone database with our prices tell me am I on the right path:
Private Sub TestReader()
Dim reader As XmlReader = XmlReader.Create(String.Format("{0}\Items.xml", My.Computer.FileSystem.SpecialDirectories.Temp))
reader.MoveToContent()
While reader.Read
If reader.NodeType = XmlNodeType.Element And reader.Name = "Items" Then
Dim row As DataSetPricing.ItemsRow = New DataSetPricing.ItemsDataTable().NewItemsRow
While reader.Read
If reader.NodeType = XmlNodeType.Element Then
Dim element As XElement = XElement.ReadFrom(reader)
Select Case reader.Name
Case "PK_ItemID"
row.PK_ItemID = element.Value
Exit Select
Case "ParentID"
row.ParentID = element.Value
Exit Select
Case "ERINumber"
row.ERINumber = element.Value
Exit Select
Case "Comparative"
row.Comparative = element.Value
Exit Select
Case "AlphaIndex"
row.AlphaIndex = element.Value
Exit Select
Case "Description"
row.Description = element.Value
Exit Select
Case "ImKing"
row.ImKing = element.Value
Exit Select
Case "FK_ManufacturerID"
row.PK_ItemID = element.Value
Exit Select
Case "FK_StatusID"
row.FK_StatusID = element.Value
Exit Select
Case "FK_LevelTypeID"
row.FK_LevelTypeID = element.Value
Exit Select
Case "FK_WorkGroupID"
row.FK_WorkgroupID = element.Value
Exit Select
Case "FK_CommodityID"
row.FK_CommodityID = element.Value
Exit Select
Case "UPC"
row.CatalogNumber = element.Value
Exit Select
Case "FK_UOMID"
row.FK_UOMID = element.Value
Exit Select
Case "Retail"
row.Retail = element.Value
Exit Select
Case "Cost"
row.Cost = element.Value
Exit Select
Case "Labor"
row.Labor = element.Value
Exit Select
Case "Multiplier"
row.Multiplier = element.Value
Exit Select
Case "ReportGroup"
row.ReportGroup = element.Value
Exit Select
Case "DateEffective"
row.DateEffective = element.Value
Exit Select
Case "ImageURL"
row.ImageURL = element.Value.ToString
Exit Select
Case "CatalogPageURL"
row.CatalogPageURL = element.Value.ToString
Exit Select
Case "LastUpdateDateTime"
row.LastUpdateDateTime = element.Value
Exit Select
Case "RowID"
row.RowID = element.Value
Exit Select
End Select
End If
End While
End If
End While
End Sub
|
|
|
|
|
Hi,
i want to create an option when I click right on 2 files.
I added the regkey in HKCU\Software\Classes*\shell and command.
but when I select my option it is executed twice. Once on file 1 and once on file 2. I want to run the command on the 2 files at once so that I can check that there are exactly 2 files selected as a parameter and than I can do my stuff with those files.
How can I make windows run my command on the 2 files in 1 instance of my command?
Jan
|
|
|
|
|
It will now launch two instances, right?
There's some articles here on preventing a second instance of your app, and how to send the starting-params to the first instance of the application, before exiting.
That way the first instance of the app could receive the params for the second instance and do it's work, while the second instance exits.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Unfortunately it's not an app but a vb-script. I try to converted it and work like you describe
thanks
I'll get back later; Maybe a lot later
Jan
|
|
|
|
|
I have a TreeView control within the main form. The main form processes the normal
drag/drop event processing. The drag/drop operation performs successfully except for this
little problem.
When I do a DoDragDrop() operation within the TreeView, when dragging the mouse 'within' the
TreeView, the main form receives drag drop events. I only want the 'main form' events when the mouse is within the main form client area. What have I missed?
Thanks
Private Sub FolderTree_Drag(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles MyBase.ItemDrag
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim node As TreeNode = CType(e.Item, TreeNode)
Dim dataObject As New DataObject()
Dim sFiles As New StringCollection
sFiles.Add(node.FullPath)
dataObject.SetData(ConstDragDropFormat, sFiles)
' Invoke the drag and drop operation
DoDragDrop(dataObject, DragDropEffects.Copy)
End If
End Sub
I have tried this code in the TreeView but it does not help.
Private Sub TreeView_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
e.Effect = DragDropEffects.None
End Sub
Private Sub TreeView_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
e.Effect = DragDropEffects.None
End Sub
Private Sub TreeView_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragOver
e.Effect = DragDropEffects.None
End Sub
|
|
|
|
|
Hi there
Is there any method for IPC between VBS and C#?
Hope to use Sendmessage API, but I couldn't find any example how to send message from VBS
If you also suggest other way to send message from VBS to C#, It would be very appreciated
Thank you
|
|
|
|
|
What are you really trying to achieve ...?
|
|
|
|
|
There is no IPC between languages. There is between applications.
You haven't described what you're doing in VBS and in the C# code, not even what kind of app you've written in C#. Is this a COM component, a Windows Forms app, WPF app, ... ? What?
VBS cannot directly call Win32 functions, including SendMessage, but it can be done using a custom COM-component.
You're going to go into a lot more detail about what you're doing to get any meaningful answer.
|
|
|
|
|
Oh, I'm sorry to give any detail that I want to do.
Because I'm beginner here, just thought WPF is the only APP for C#, I applogize
My plan is, send data from VBS to WPF app.
I mean, Communication Between two programs in local computer not through the internet
For example,
Dim Data = "Hello"
I want to transmit "Hello" from VBS to WPF APP, and invoke popup message from WPF APP as "Hello"
If I can make two-way communication between VBS and WPF APP, it would be the best
but, To build VBS for Trasmission and WPF for Reception is also enough
Thank you
|
|
|
|
|
A better what to do that would be to use an Inter Process Communication method (IPC), like named pipes or memory mapped files.
The problem here is that VBScript doesn't have any native way to do any kind of IPC. It would take writing a COM-based component that your VBScript code can use (see the CreateObject function) to handle the IPC heavy lifting.
You would also have to implement the "server-side" of the communication channel in your WPF app.
|
|
|
|
|
Dear friends
please help me how to deal with this error object variable with block variable not found not found
|
|
|
|
|
You have to show us the code that is causing the error for us to even have half a chance of helping you!
|
|
|
|
|
You haven't supplied the code you're having a problem with and you expect someone to be able to help you?
|
|
|
|
|
unable to create a win-from for mailing 2 many clients using vb.net
|
|
|
|
|
You have our sympathies.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Dear Friends at code project,
The code i use is as follows
Private Sub BtnExcel_Click(sender As Object, e As EventArgs) Handles btnExcel.Click
Try
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim dataSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim path As String = "C:\Users\Abhimanyu Singh\Documents\excel\SalarySlip.xlsx"
MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [salaryslip$]", MyConnection)
dataSet = New System.Data.DataSet
MyCommand.Fill(dataSet)
DataGridView1.DataSource = dataSet.Tables(0)
MyConnection.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
End Class
It works well for a single Excel file but if i try to open another fileit gives me error
"OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET"
IAM NOT ABLE TO MOVE AHEAD PLEASE SUGEST REMIDIES
|
|
|
|
|
Again. Without the code you're using and a description of any problem or errors you're having, it's impossible for anyone to help you.
Stop typing as little as possible.
|
|
|
|
|
I'm using ToolStripProfessionalRenderer to customize a toolstrip. The toolstrip buttons are generated programmatically as needed. The program starts with three buttons. I'm using a LinearGradientBrush to paint the ToolStripButtons, but only the first one (left) gets the gradient. Using the renderer is new to me, so I'm probably missing something obvious.
Private Sub menuRndr_RenderButtonBackground _
(sender As Object, e As ToolStripItemRenderEventArgs) _
Handles Me.RenderButtonBackground
Try
If e.ToolStrip.Equals(main.tabs) Then
Dim p As New Pen(Brushes.Black, 1)
Dim lgb As New LinearGradientBrush(e.Item.Bounds,
Color.SteelBlue,
Color.WhiteSmoke,
LinearGradientMode.Vertical)
e.Graphics.FillRectangle(lgb, e.Item.Bounds)
e.Graphics.DrawRectangle(p,
New Rectangle(New Point(e.Item.Bounds.Left, e.Item.Bounds.Top),
New Size(e.Item.Bounds.Width, e.Item.Bounds.Height)))
End If
MyBase.OnRenderItemBackground(e)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
|
|
|
|
|
Hi Gerry this is Doss. Thanks for your advice.
Then I try something altered my code with your advice. Finally I get the result. MDI Child form is do transparent. First i put the code in the parent form and put the code in a child form. It is worked OK.
At the same time i want see the contents of controls another child form behind the transparent child form but the transparent child form didn't show the contents of other child forms. what can i do. please help.
And how can i upload a sample images of my project result?(sorry my poor language)
|
|
|
|