Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
In my application developped with vb.net , i have 3 Method
the first : function first () as parent reference
the second : function second (parent reference ) as parent reference
the third : sub third (parent reference)

in the button event , after a test (if) , i want to call those method

I mean , when (for example) i call first , i want to know exactly the value which return this méthod

in my code (in event button ) , i do :

dim ref as parent reference
dim res as parent reference 
ref= first()
res = second(ref) 


but always the result is false

Dim ref As ParentReference ' reference folder ')
      'reference sous dossier
      Dim res As ParentReference ' reference subfolder

      If (exist(folder_name.selectindex) = True) Then
          MessageBox.Show("Exist folder , Vérify subfolder")

                   here i call creation subfolder (i need folder reference exactly)



folder , subfolder and file are in google drive

What I have tried:

i have to tried to call a method from event button
Posted
Updated 31-Jul-17 22:14pm
v4
Comments
OriginalGriff 1-Aug-17 3:31am    
We're going to need to know what first and second also look like...
Use the "Improve question" widget to edit your question and provide better information.
Graeme_Grant 1-Aug-17 3:38am    
You have a Button that does...? Each method (function or subroutine) has a purpose, may need to pass some values or objects to, and may just perform a task, or may need to return some form of result.

Are you able to explain what you are attempting to write?
Member 8587273 1-Aug-17 3:46am    
the first method is creationfolder , the second subfolder and the third is uploding file
after existance test , i need when i create a subfolder , i want it in the folder
so , i want to know reference exactly (the folder ) then i call the sub foolder
I improve my post , and i add how i call it

1 solution

This should get you started:
VB
Module Module1

    Sub Main()

        Dim ParentFolder As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        Dim ChildFolder As String = "NewChildFolder"

        CreateFolder(ParentFolder, ChildFolder)
    End Sub

    Private Sub CreateFolder(ParentFolder As String, ChildFolder As String)

        Dim FolderPath = IO.Path.Combine(ParentFolder, ChildFolder)

        If Not IO.Directory.Exists(FolderPath) Then
            MkDir(FolderPath)
        End If
    End Sub

End Module


UPDATE - GOOGLE DRIVE

You have already asked several questions on Google Drive. To recap:
* Folder Exists - How to found if folder exist or not[^]
* Upload File - How to insert a file in specific folder in Google drive VB.NET[^]

Google Drive API documentation has .Net code for Creating a folder: Work with Folders  |  Drive REST API  |  Google Developers[^]

Copied directly from the Google Drive API documentation:
C#
var fileMetadata = new File()
{
    Name = "Invoices",
    MimeType = "application/vnd.google-apps.folder"
};
var request = driveService.Files.Create(fileMetadata);
request.Fields = "id";
var file = request.Execute();
Console.WriteLine("Folder ID: " + file.Id);
 
Share this answer
 
v2
Comments
Member 8587273 1-Aug-17 3:59am    
the folder and subfolder ,file are in google drive
Graeme_Grant 1-Aug-17 4:11am    
Please update your question to specify that you are working with Google Drive and not the standard file system.
Member 8587273 1-Aug-17 5:15am    
I want how a know exactly folder reference when i call foldercreation method
Graeme_Grant 1-Aug-17 5:26am    
var file = request.Execute();
Console.WriteLine("Folder ID: " + file.Id);
Member 8587273 1-Aug-17 5:42am    
this code in the same method
me , i want to know the reference when i call foldercreation method in main method
i want to know foldercreation return value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900