Hello Fellow Members,
Please I work in a company where land/site plans are used. These plans have coordinates on them. I want these coordinates to be entered which Google will take you to the exact plot.
In fact, any sample code or links will be welcomed.
What have you tried?
Where are you stuck?
What help do you need?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
Hi all. I've seen how to do a file system watch on a local folder. Is it possible to watch a remote folder on an ftp site?
Code for local folder:
gfswWatchFolder = New System.IO.FileSystemWatcher()
'This is the path we want to monitor
gfswWatchFolder.Path = "C:\My Documents\Temp2"'Add a list of Filters we want to specify, making sure'you use OR for each Filter as we need to all of those
gfswWatchFolder.NotifyFilter = IO.NotifyFilters.DirectoryName
gfswWatchFolder.NotifyFilter = gfswWatchFolder.NotifyFilter Or IO.NotifyFilters.FileName
gfswWatchFolder.NotifyFilter = gfswWatchFolder.NotifyFilter Or IO.NotifyFilters.Attributes
'Add the handler to each eventAddHandler gfswWatchFolder.Changed, AddressOf LogChange
AddHandler gfswWatchFolder.Created, AddressOf LogChange
AddHandler gfswWatchFolder.Deleted, AddressOf LogChange
'Add the rename handler as the signature is differentAddHandler gfswWatchFolder.Renamed, AddressOf LogChange
'Set this property to true to start watching
gfswWatchFolder.EnableRaisingEvents = True
<pre> PrivateSub LogChange(ByVal source AsObject, ByVal e As System.IO.FileSystemEventArgs)
'Form_Load: System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = FalseIf e.ChangeType = IO.WatcherChangeTypes.Changed Then
TextBoxMultiLine1.Text = "File " & e.FullPath & " has been modified." & vbCrLf
EndIfIf e.ChangeType = IO.WatcherChangeTypes.Created Then
TextBoxMultiLine1.Text = "File " & e.FullPath & " has been created." & vbCrLf
EndIfIf e.ChangeType = IO.WatcherChangeTypes.Deleted Then
TextBoxMultiLine1.Text = "File " & e.FullPath & " has been deleted." & vbCrLf
EndIfIf e.ChangeType = IO.WatcherChangeTypes.Renamed Then
TextBoxMultiLine1.Text = "File " & e.FullPath & " has been renamed." & vbCrLf
I know how to open a remote folder using
<pre>Dim request As FtpWebRequest = DirectCast(WebRequest.Create(mstrFTPUri & strRemoteApplicationFolder), FtpWebRequest)
etc. etc. but how do I combine the two? Thanks in advance.
Private Sub DeleteCategories()
Dim objNS As NameSpace
Dim objCat As Category
Set objNS = Application.GetNamespace("MAPI")
If objNS.Categories.Count > 0 Then
For Each objCat In objNS.Categories
Set objCat = Nothing
Set objNS = Nothing
I am calling Form_BeforeUpdate directly from a Close (Form) button's onClick Event, to handle various circumstances when the form is only partially filled in but the User wants to bail out. Under certain (perfectly feasible) circumstances, Form_BeforeUpdate is correctly setting Cancel to True within itself, but it is not being passed back to the calling Sub! Subroutine parameters are ByRef by default, but setting Cancel explicitly to ByRef in the definition of Form_BeforeUpdate does not change the misbehavior. Here are the two Subs:
Private Sub cmdClose_Click()
Dim Cancel As Integer
If Cancel Then
If MsgBox("This record contains errors. Do you wish to correct them before closing the form?", vbYesNo, "Errors") = vbYes Then
If Me.NewRecord Then
MsgBox "The current record will be discarded.", vbInformation
MsgBox "Any changes made to the current record will be discarded.", vbInformation
blMayClose = True
DoCmd.Close acForm, Me.Name
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rst As New ADODB.Recordset
If Me.NewRecord Then Contact_Pt = lbxContacts.Value
Set rst = New ADODB.Recordset
rst.Open "SELECT ID FROM Assets WHERE package_Pt = " & ID, CurrentProject.Connection, adOpenStatic, adLockReadOnly
If Not (rst.EOF And rst.BOF) Then
If IsNull(Start_Date.Value) Or IsNull(End_Date.Value) Then 'this is where Cancel gets set to True
MsgBox "You must enter start and end dates for the package before saving it.", vbExclamation, "Dates Missing"
Cancel = True
ElseIf End_Date.Value <= Start_Date.Value Then
MsgBox "The end date must be after the start date.", vbExclamation, "Invalid dates"
Cancel = True
Set rst = Nothing
Using the parentheses is forcing VBA to evaluate the bracketed expression (in this case, your variable Cancel) and then pass it as ByVal into the subroutine. Ergo the value remains unchanged in the calling sub.
See Matthieu Guindon's solution here [^] for a fuller explanation
Thanks! I had given up and used a workaround (which actually turned out to have other advantages, so it wasn't all bad). VBA's requirement that you not surround sub/function arguments with parens (unless you make an explicit Call) is always catching me out, since every other language I use require the parens. Fortunately, it mostly affects implicit calls with multiple arguments, where putting in the parens provokes an immediate syntax error in the editor. This case is a particular pain since the bad syntax is not flagged but nevertheless changes the meaning of the call.
from my Visual Basic Scriot ( Visual Studion 2015) wenn i call my funktion from ma scrip like tis
Private Sub Request_1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Request_1.Click
Dim r As Integer
Dim data As String
Dim ID As String
Dim sender As String
sender = "DatO"
If ID_KS_1.Text <> "" Then
ID = "ID_KS=" & ID_KS_1.Text & ","
sender = "KS_Trifact"
ErrorText.Text = ""
If obj Is Nothing Then obj = CreateObject("NmsTaskDbSv.64Bit_NmsDbData")
'UPGRADE_WARNING: Couldn't resolve default property of object obj.Request. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
'r = obj.Request(15101, "1.0", sender, "customerservice/customer", ID & "ACCOUNT=" & Par_1_1.Text, "test")
r = obj.Request(15101, "1.0", sender, "customerservice/customer", ID & "ACCOUNT=" & Par_1_1.Text, (data))
If (r = 0) Then
Result_1.Text = data
it seams to work but rhe response dues not arrive in the data variablele wenn i make the call j = CreateObject without () lik this
Hi everyone, my name is Maurizio and my question is this
In VB I would like to know how to create one or more objects of the same type at run time.
1) In a form I insert a textbox1 and a button
The purpose of my request is to know how: By pressing this button
It should bring up another textbox and so on.
that's all !!!!
If I remember correctly I used the New function
But it seems that this does not work in vb.
Could you please help me Thanks
Greetings from Maurizio
You can do it like suggested by Dave - the other way could be (perhaps easier to code and to maintain for you) :
- Create the Textbox you want to bring up from the beginning with the Designer.
- Set it's Visible-State to False
- When pressing the Button set it's Visible-State to True.
In this case you are able to make all the relevant connections.
You don't need to modify the Controls-Collection from the Form, catch the Events from the new Control and so on ...
Thank you to everyone for your interest
But it wasn't the answer I would have expected from experienced people like you.
/p.s) But if instead of cloning I asked for a sort of (Textbox) Dynamic with at least 5 possibility of creating (Textbox) on request!
What would have changed?
I'll explain :
If I press the key inserted in the form and I create the first dynamic (Textbox)
How can I go about creating a new one at least five times the same size as the first?
I tried to write something like this; But it is valid only for the first dynamic (Textbox)
Therefore I would miss being able to create all the others every time I press the create button.