Im trying to load a google static map in a winform. I found a control online that would helpme but i cant get it working. i got the control from Here. i was not able to drag on the control on to the form like others. i have also email the dev of the control but have not heard back yet.
Any help would be Great.
Thank
here is my code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim gmap As New CtpGglMap.Impl.StaticGMap
gmap.Center.Address = "New york ,NY"
gmap.Zoom = 14
gmap.Height = 400
gmap.Width = 600
gmap.Sensor = False
PictureBox1.Image = gmap
End Sub
Got it working.
Dim gmap As New CtpGglMap.Impl.StaticGMap
Dim temp As New GMarker
Dim temp2 As New GMarker
gmap.Center = New GeoPointImpl(41.5442847, -73.8732391)
gmap.Zoom = 14
gmap.Height = 334
gmap.Width = 362
gmap.Sensor = False
TextBox1.Text = GetDrivingDirectionFromGoogle("fishkill ,ny", "41.5442847, -73.8732391")
temp.Point = New GeoPointImpl(41.5442847, -73.8732391)
temp.SetMap(gmap)
'CREATE A BITMAP FROM THE MEMORY STREAM
PictureBox1.Image = New System.Drawing.Bitmap(gmap.Fetch)
Related
I want my app to check for the EXE files (App1.exe, App2.exe, App3.exe ect.) while the app is in the 'splash screen' form, I currently have this code for the SplashScreen. It uses form1 for the code
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim splash As Splash_screen = CType(My.Application.SplashScreen, Splash_screen)
Dim Label() As String = {"Starting Up...", "Verifying apps...", "Finalizing"}
For i As Integer = 0 To Label.Length - 1
splash.UpdateProgress(Label(i), CInt((i + 1) / Label.Length * 100))
System.Threading.Thread.Sleep(1500)
Next
End Sub
End Class```
Depends on what you want to do with it. But here's some LINQ which can help perform the search
Dim fileList = {"app1.exe", "app2.exe", "app3.exe"}
Dim allFilesExist = fileList.All(Function(f) System.IO.File.Exists(f))
Dim filesWhichExist = fileList.Where(Function(f) System.IO.File.Exists(f))
Dim filesWhichDontExist = fileList.Where(Function(f) Not System.IO.File.Exists(f))
im trying to do how to assign a specific file to play in a player. no need for file dialog.
what i need is if i click the button1 the flash will play.
i do like this
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim swffile As String = "C:\Users\Rj Shadow\Documents\UM Buildings\BE.swf"
AxShockwaveFlash1.LoadMovie(0, swffile)
AxShockwaveFlash1.Play()
AxShockwaveFlash1.Loop = False
End Sub
this does't work..
Hit same problem. After a few hours - it's the order of the code that's important. In case anyone else stumbles here, this works:
Dim flash1 As New AxShockwaveFlash
.....
flash1.Location = New System.Drawing.Point(300, 23)
Me.Controls.Add(flash1)
flash1.Movie = "C:\Users\Steve\Scripts\Projects\CPWizBiz\Assets\Test SWFs\Artwork4.swf"
flash1.Size = New System.Drawing.Size(192, 400)
flash1.Play()
I am trying to write the code for a back button in my VB.NET app. But it is not working. What is wrong with it?
Private Sub BackBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackBtn.Click
Dim returntext As String = Clipboard.GetText()
lblDictword.Text = returntext
Dim returnHtmlText As String = Nothing
If (Clipboard.ContainsText(TextDataFormat.UnicodeText)) Then
returnHtmlText = Clipboard.GetText(TextDataFormat.UnicodeText)
'Clipboard.SetText(replacementHtmlText, TextDataFormat.Html)
Clipboard.SetText(returnHtmlText, TextDataFormat.UnicodeText)
End If
lblDictword.Text = returnHtmlText
'Return returnHtmlText
Dim count As Integer = myStrings.Length
If count > 1 Then
Dim s As String = myStrings.ElementAt(count - xd)
xd = Array.IndexOf(myStrings, s)
lblDictword.Text = s
End If
End Sub
I am not an VB.NET expert, but usually getting access to clipboard isn't as easy as it looks. Check this:
Problem with clipboard class
It can be only a tip, not really solution. Look into your clipboard functionallity
I have searched and seen countless samples here in this forum and in other sites but I'm still stuck with this problem;
I want to add a Click Handler for dynamically created PictureBox-es and pas an argument on it so I know which one of picture boxes was clicked).
Here is my current code:
Public Class frmMbarimAbonimi
Private Sub frmMbarimAbonimi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'FitnessdbDataSet.clients' table. You can move, or remove it, as needed.
'Me.ClientsTableAdapter.Fill(Me.FitnessdbDataSet.clients)
'===============
Dim dt As DataTable = PaPaguar()
Dim i As Integer = 0
Dim gr(dt.Rows.Count) As GroupBox
Dim pp(dt.Rows.Count) As PictureBox
Dim lb(dt.Rows.Count) As Label
For Each row As DataRow In dt.Rows
gr(i) = New GroupBox
gr(i).Width = 200
gr(i).Height = 180
pp(i) = New PictureBox
pp(i).SizeMode = PictureBoxSizeMode.StretchImage
lb(i) = New Label
'-------------------------
Try
Using str As Stream = File.OpenRead("C:\Fotot\" + dt.Rows(i).Item("Foto"))
pp(i).Image = Image.FromStream(str)
End Using
lb(i).Text = dt.Rows(i).Item("Emer")
Catch ex As Exception
MsgBox("Fotoja nuk mund te ngarkohet, ju lutem realizoheni nje foto tjeter!!!")
End Try
'-------------------------
pp(i).Visible = True
pp(i).Width = 200
pp(i).Height = 150
AddHandler pp(i).Click, AddressOf testini
gr(i).Controls.Add(pp(i))
lb(i).Visible = True
lb(i).Width = 200
lb(i).Height = 30
lb(i).Left = pp(i).Left
lb(i).Top = pp(i).Top + 150
lb(i).BackColor = Color.WhiteSmoke
lb(i).BringToFront()
gr(i).Controls.Add(lb(i))
flpanel.Controls.Add(gr(i))
i = i + 1
Next row
End Sub
End Class
So I was trying to use AddHandler pp(i).Click, AddressOf testini but obviously this does not allow me to call "testini" with a parameter to identify which picture box was clicked.
Can someone point me in the right direction or give some advice? Greatly appreciated.
You need to add something to your created PictureBox to identify them in the event handler because you can't change the signature of the click event handler adding a 'parameter'
For example, you could set the Name property
pp(i) = New GroupBox
pp(i).Name = "PictureBox" + i.ToString
then in the event handler you could recognize your picture box casting the sender object to a picturebox and grabbing the Name property.
Remember, sender is always the control that triggers the event. In your case is always one of your dinamically created PictureBoxes
Private Sub testini(sender As Object, e As System.EventArgs)
Dim pb As PictureBox = DirectCast(sender, PictureBox)
Dim pbIdentity As String = pb.Name
.....
End Sub
I've finally got around to starting windows phone dev. I'm not very good at it yet, but anyway, I hope you guys understand what I want to do here.
From what I've learnt from other programmers, an ObservableCollection can be updated in live time whilst it is databound to an object, such as a listbox. All changes to the ObservableCollection will cause the UI of the object it's databound to update it's items.
So what I'm trying to do, is download a file from my server, parse it with json, then update the ObservableCollection with the new data. However, the webclient doesn't seem to be downloading the new data until the app is re opened!
Here's a gif showing how the app works at the moment:
And here's my code (cut down a bit):
Dim aList As New ObservableCollection(Of classes.consoles)
Private Sub PhoneApplicationPage_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
checkforconsoles()
End Sub
Public Sub checkforconsoles()
Dim wc As New WebClient()
AddHandler wc.DownloadStringCompleted, AddressOf downloaded
wc.DownloadStringAsync(New Uri("http://localhost/api/?function=GetConsolesForUser&userid=" & id))
End Sub
Private Sub downloaded(sender As Object, e As DownloadStringCompletedEventArgs)
aList.Clear()
'MessageBox.Show(e.Result)
Dim o As JObject = JObject.Parse(e.Result)
Dim jarray As JArray = DirectCast(o("results"), JArray)
Try
Dim i As Integer = jarray.Count()
For i = 0 To jarray.Count() - 1 Step 1
Dim id As String = jarray(i)("id").ToString
Dim name As String = jarray(i)("name").ToString
Dim image As String = jarray(i)("image").ToString
MessageBox.Show(name)
Dim c As classes.consoles = New classes.consoles()
c.categoryimage = New Uri(image)
c.categoryname = name
c.categoryid = id
aList.Add(c)
Next
listBoxview.ItemsSource = aList
StackPanel1.Visibility = Windows.Visibility.Collapsed
StackPanel2.Visibility = Windows.Visibility.Visible
Catch ex As Exception
StackPanel2.Visibility = Windows.Visibility.Collapsed
StackPanel1.Visibility = Windows.Visibility.Visible
End Try
End Sub
Private Sub ApplicationBarIconButton_Click_1(sender As System.Object, e As System.EventArgs)
checkforconsoles()
End Sub
Does anybody have any clue what's wrong? :(
Thanks in advance.
It's a cachine issue with the WebClient. You can append a random query string to ensure that the URL is always unique so that the WebClient doesn't cache the results. One way to do this is to add a random GUID value since it's very unlikely to generate two of the same GUIDs in a short time frame.
wc.DownloadStringAsync(New Uri("http://localhost/api/?function=GetConsolesForUser&
userid=" & id & "&random=" + Guid.NewGuid().ToString()))