Search code examples
vb.netvb.net-2010network-drive

What does "R"c mean when mapping a network drive using this function


I copied code to map a network drive from http://www.vbforums.com/showthread.php?t=616519 to map the drive and http://cjwdev.wordpress.com/2010/05/30/delete-network-drive/ to delete the drive. I want to know what "R"c means in this code:

    RemoveNetworkDrive("R"c, True)

which came from the first link and then I want to know how to simulate this notation in a variable so I can check for the first available drive and map the network drive to that letter. I would Google search it but since I don't know what "R"c means it makes it difficult.


Solution

  • "R"c is the Char version of "R". You use it when you want to specify a character rather than a string.

    MSDN has some details here:

    You can also create an array of strings from a single string by using the String.Split Method. The following example demonstrates the reverse of the previous example: it takes a shopping list and turns it into an array of shopping items. The separator in this case is an instance of the Char data type; thus it is appended with the literal type character c.

    Dim shoppingList As String = "Milk,Eggs,Bread"
    Dim shoppingItem(2) As String
    shoppingItem = shoppingList.Split(","c)