How to change FolderbrowserDialog Title in Vb.net - vb.net

I found some indirect methods to change the title in C#. But Is there any way to change the title in VB.
Dim folderbrowser As New FolderBrowserDialog()
for openfiledialog there is direct method.But I need a folder browser

I do not believe you can - at least without an unmanaged api call of some sort.
You can though change the Description which appears above tree in the dialog.
See here for docs on that: https://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.description(v=vs.110).aspx
Re methods you found in C# to do thi. Well - if you did - you could implement it in VB.Net. You can basically do virtually anything in VB.net that you can do in C# - so you should be able to write VB.Net code that does the same thing.

vb.net
Dim dlg as FolderBrowserDialog = new FolderBrowserDialog()
dlg.Description = "Select the document folder"
Dim result As DialogResult = folderBrowserDialog1.ShowDialog()
c#
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.Description = "Select the document folder";
DialogResult result = folderBrowserDialog1.ShowDialog();

Related

Execute custom ArcGIS model with Visual Basic

I made a function which should execute a custom ArcGIS model.
I use VB 2010 with ArcGIS 10.2. The button which should execute this function is placed on a dockable window.
Dim model As Geoprocessor = New Geoprocessor()
model.AddToolbox("D:\Chris\Van Hall Larenstein\Ruimtelijke Informatie Technologie\RPS\RPS.tbx")
Dim parameters As ESRI.ArcGIS.esriSystem.IVariantArray = New ESRI.ArcGIS.esriSystem.VarArrayClass()
model.Execute("RPS_TEST", parameters, Nothing)
There are no errors reported in VB 2010, but it doesn't work in ArcGIS. What am I doing wrong?
EDIT:
Dim pToolHelper As IGPToolCommandHelper2 = New GPToolCommandHelper
'Set the tool you want to invoke.
Dim toolboxPath = "C:\Program Files\ArcGIS\Desktop10.2\ArcToolbox\Toolboxes\Analysis Tools.tbx"
pToolHelper.SetToolByName(toolboxPath, "Buffer")
'Create the messages object to pass to the InvokeModal method.
Dim msgs As IGPMessages
msgs = New GPMessages
'Invoke the tool.
pToolHelper.InvokeModal(0, Nothing, True, msgs)
My.ArcMap.Application.CurrentTool = Nothing
Chris Driessen
If you want user define parameters than this is not the way to do it.
Your code immediately executes the model (without the parameters).
See this link on how to open geoprocessing tool dialog.

Opening pdf from Crystal Reports Viewer

Thank you for viewing my question. I am building a project in Visual Studio 2010 using vb and .net. I have a Crystal Reports report that I'm trying to have auto export and open in PDF with a button click. Right now I am using Crystal Reports Viewer in my project which opens the report fine; However, I would like to have it only open in a pdf format. Is there a way to do this?
Note: I'm not here hunting for code. I'm wanting to learn, so if you could just guide me in the right direction, that will be great (if you don't want to provide code)!
Thank you for the help.
Josh
I'm using code from http://www.codeproject.com/Articles/14549/Crystal-Reports-To-PDF-converter-Without-Crystal-R
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class clsCrystalToPDFConverter
Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim oRDoc As New ReportDocument
Dim expo As New ExportOptions
Dim sRecSelFormula As String
Dim oDfDopt As New DiskFileDestinationOptions
Dim strCrystalReportFilePath As String
Dim strPdfFileDestinationPath As String
Public Function SetCrystalReportFilePath(ByVal CrystalReportFileNameFullPath As String)
strCrystalReportFilePath = CrystalReportFileNameFullPath
End Function
Public Function SetPdfDestinationFilePath(ByVal pdfFileNameFullPath As String)
strPdfFileDestinationPath = pdfFileNameFullPath
End Function
Public Function SetRecordSelectionFormula(ByVal recSelFormula As String)
sRecSelFormula = recSelFormula
End Function
Public Function Transfer()
oRDoc.Load(strCrystalReportFilePath) 'loads the crystalreports in to the memory
oRDoc.RecordSelectionFormula = sRecSelFormula 'used if u want pass the query to u r crystal form
oDfDopt.DiskFileName = strPdfFileDestinationPath 'path of file where u want to locate ur PDF
expo = oRDoc.ExportOptions
expo.ExportDestinationType = ExportDestinationType.DiskFile
expo.ExportFormatType = ExportFormatType.PortableDocFormat
expo.DestinationOptions = oDfDopt
oRDoc.SetDatabaseLogon("PaySquare", "paysquare") 'login for your DataBase
oRDoc.Export()
End Function
End Class
You'll need to set the variables to the specifics of your project obviously. These are more than likely the classes and methods you'll be wanting to use however. This should allow you to take your crystal reports viewer file and turn it into something opened by PDF
This works for me.
Dim orpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
orpt = DirectCast(crvInvoice.ReportSource, CrystalDecisions.CrystalReports.Engine.ReportDocument)
orpt.ExportToDisk(ExportFormatType.PortableDocFormat, "PdfFileName.pdf")

Silverlight application using vb.net. Issue creating new email in lotus notes

Im writing a silverlight application in vb.net and need to send an email via lotus notes. I wish to do this by opening the lotus notes client app, open a new email window and substitute all the necessary details (to, subject etc.) in the new email window. I am using the below code but it only OPENS the lotus notes application on the machine, it does not do anything past this. Its seems that everything after the initial CreateObject call is simply ignored, although it doesnt throw any errors. I have attempt to reference interops.domino.dll but being silverlight project visual studio states the dll is not compiled for the silverlight runtime. Any assistance with this would be greatly appreciated.
Dim outlook = AutomationFactory.CreateObject("Notes.NotesSession")
Dim notesdb = outlook.GetDatabase("", "")
notesdb.OpenMail()
Dim doc = notesdb.CreateDocument()
Dim msg = "Hey whats up"
doc.ReplaceItemValue("SendTo", "person#temp.com")
doc.ReplaceItemValue("Subject", "Hello")
Dim rtitem = doc.CreateRichTextItem("Body")
rtitem.AppendText(msg)
All you do in the moment is to create a new document in the backend and fill it with values.
It is like creating a word document without opening it...
You need some more code to actually SHOW the document you created.
In addition you need to assign a Form, otherwise Notes will not know, how to display this document:
Dim session = AutomationFactory.CreateObject("Notes.NotesSession")
Dim notesdb = outlook.GetDatabase("", "")
Dim ws = AutomationFactory.CreateObject("Notes.NotesUIWorkspace")
notesdb.OpenMail()
Dim doc = notesdb.CreateDocument()
Dim msg = "Hey whats up"
doc.ReplaceItemValue("Form", "Memo")
doc.ReplaceItemValue("SendTo", "person#temp.com")
doc.ReplaceItemValue("Subject", "Hello")
Dim rtitem = doc.CreateRichTextItem("Body")
rtitem.AppendText(msg)
ws.EditDocument( True, doc )
As I do not use silverlight I unfortunately could not test the code, but It should point into the right direction.
You can not do UI manipulations via COM in Notes, as the UI-Classes (NotesUIDocument, NotesUIWorkspace, ...) are not supported via COM.
You can only use the backend-classes likes NotesDocument, ...
This still leaves you a lot of possibilites, as you can eiter use NotesRichTextItem or MIMEEntity classes to compose e-mails.

vb.net scan installation folder for rtf documents

Does someone know a code so that my program looks in the map where it is installed for rtf documents and show them in a combobox. I am making an agenda.
It can search for "VPA event -" in the title too (that is what all the event names start with). If i have the code to d that then i can use this one to read the events
Dim objreader2 As New System.IO.StreamReader(ComboBox1.Text & ".rtf")
RichTextBox2.Text = objreader2.ReadToEnd
objreader2.Close()
thanks
Here's the code you can use to load the comboBox. After that, you can use the SelectedIndexChanged event (or other events) to read the file into the rich text box. I didn't test this, but it should be pretty close.
dim ss() as string
fPath = System.Windows.Forms.Application.UserAppDataPath
' or fPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments, or other directory
ss = Directory.GetFiles(fPath, "*.rtf")
ComboBox1.items.clear()
for each string s in ss
ComboBox1.Items.add(s)
next s

How can I make a "browse for file.." button in VB.net?

I'm trying to build a simple FTP uploader. How can I make it so the user can select a file to upload? See, what I want is to have a button (which I do) that a user can click, and it shows the OpenFileDialog (which I have), but then when they select a file, I want its path to be shown in a text box. How can I do that?
Try the following code
Dim dialog As New OpenFileDialog()
If DialogResult.OK = dialog.ShowDialog Then
TextBox1.Text = dialog.FileName
End If
One way is to convert the filename to a FileInfo which contains all sorts of information about the file including the path. This opens the dialog and displays the path of the selected file.
If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim fi As New System.IO.FileInfo(OpenFileDialog1.FileName)
TextBox1.Text = fi.DirectoryName
End If
You want to get the OpenFileDialog's property Filename property. See OpenFileDialog's class members here on MSDN.
Hope this helps
Add a OpenFileDialog And Add This Code
If YourOpenFileDialogName.ShowDialog = YourOpenFileDialogName.OK Then
textBox1.Text = YourOpenFileDialogName.FileName
End If