VB Using ShowDialog, can I get SelectedPath entry to scroll to top? - vb.net

I'm setting the SelectedPath parameter of a dialog on a Windows form and it's working. The problem is that it's not visible when the modal form displays. If I scroll down, I can see that it has highlighted the correct folder, but I'd like that folder to be at the top of the scroll window if possible. I'm not too familiar with VB or VStudio so I would appreciate any help. Here's the code that I'm using to set the parameter.
If myVariables.myEHDConnected = True Then
dlgTarget.SelectedPath = myVariables.myEHDDrive & "Storage\"
End If
This code does highlight the directory but it's not visible when the modal form opens.

I changed the Root Folder property of the dialogue to My Computer instead of Desktop and it worked fine. It scrolled down to a point where the selected directory was visible. The problem was mine for not having set the Root Folder properly.

Related

Button not displayed while running the program

I am using vb.net 2008, I added a button from design view in one of my forms.It shows in the form design view, I gave it the click code to load another form but after I run the program and look in that form, it does not show the button that I added while I run the program. what is the problem? And What are the solutions?
Thanks!
As you can see, I added a Back Button here
THis image is while I run the program. Back button is not displayed here.
I would suggest running something like this in order to see if the control is there. Listing if it is Visible would also be helpful.
https://stackoverflow.com/a/12985464/7340880
Private Sub GetControls()
For Each GroupBoxCntrol As Control In Me.Controls
If TypeOf GroupBoxCntrol Is GroupBox Then
For Each cntrl As Control In GroupBoxCntrol.Controls
'do somethin here
Next
End If
Next
End Sub
The only way I can help you without you providing us more information like code or error info if exist (or maybe a warning), I will suggest you to copy the code from your button then delete the current button and a new one. Then paste the code back to new button.
And make sure you don't hide or change the visible property button somewhere in the code. If you are working with positioning in the code make sure you don't move your button.
Thank you for your support. The problem was that it was running the old .exe file. I deleted the old .exe file from the /bin/debug directory. And after I ran the program, it created me a new .exe file and hence my problem was solved.
Thank you again.

NSOpenPanel New Document button not working

I can't seem to get the Open Panel's New Document button to work. Currently I am just using the default application provided Open Panel (iCloud enabled OS X app) which has a New Document button at bottom left of the window.
However I just get a system beep when I click on it, I would expect this button would do the same as File->New menu option but it does nothing other than beep.
How can I either enable this button to simply create a new blank file or remove it altogether.
Finally I figured it out.
It seems the New Document button is somehow hardware to the CMD+N keystrokes. I had reassigned CMD+N to apply Normal style to text and this breaks the New Document button.
Seems odd that the button is not wired to newDocument method on First Responder rather than to a keystroke combination.
EDIT
I logged a Bug ID# 14886108 and it seems it may be fixed in Mavericks

Hide the folder and navigation vb.net

I want to hide the folder and it should not be found when i click show hidden file at navigation.
I use this code to hide the file
System.IO.File.SetAttributes(FilePath, IO.FileAttributes.Hidden)
Even if you mark something IO.FileAttributes.Hidden or even as IO.FileAttributes.System, they will still be visible after a couple checkbox clicks. The only way to really hide something would be like in stenography, truecrypt, etc.

VB.Net UI is missing

I'm using Visual Studio 2012 to make a Vb.Net application.
In short, I added DotNetBar RibbonControl with some RibbonItems on it as my menu.
What happened is one of my tab is suddenly missing along with all the buttons in it.
I have searched for it on my Document Outline still no luck.
But what even more odd is, when I tried to recreate it with the same name, it shows an Alert "Property value is not valid" with message "The name AppPOButton is already in use by another component".
When I checked it on the form's Designer I do found this lines:
Me.AppPOButton = New DevComponents.DotNetBar.ButtonItem()
and
'AppPOButton
'
Me.AppPOButton.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText
Me.AppPOButton.Image = Global.ProjectBMT.My.Resources.Resources.approval
Me.AppPOButton.ImageFixedSize = New System.Drawing.Size(40, 40)
Me.AppPOButton.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.AppPOButton.Name = "AppPOButton"
Me.AppPOButton.SubItemsExpandWidth = 14
Me.AppPOButton.Text = "Approve"
Me.AppPOButton.Visible = False
and
Friend WithEvents AppPOButton As DevComponents.DotNetBar.ButtonItem
Is there anyone can explain why this is happening?
Thank you
This behavior is weird itself, but it's not a problem actually, All the Ribbon style works on "Containers", if you check your ribbon control and click the left-upper button will see these little arrows that move four containers, these objects hold the buttons, images and other controls. Within your design window in the right panel (Properties) you can still see the names of the controls you "lost" when you deleted your tab, wich is also a container.
Steps:
Add a container within your design view and Dock it into the Ribbon control Form.
Click on the uppper right boton (Right Arrow) and select "Layout Ribbon", this will adjust the lenght and hight of the controls conatained.
Add the tab that will contain all the controls you have.
The fact that they are still in the designer form is the prove that they still exist, This behavior is just a glitch in the position and order of the controls set above your form ;-)

Image location (code) of PictureBox control

I'm inexperienced with windows forms (vb.net), and I have a rather silly question.
I'm opening an old project of someone elses, and there's a PictureBox control on the form. The PictureBox has a photo, and I'm trying to find the location of the photo on the computer but can't find it.
In ASPX, I can just look at the code behind and find out where the tags are pointing to (for the photo).
Is there a way to do that for vb.net?
Update:
The only code that exists for my object, with the image property is this:
Me.pbTotal.Image = CType(resources.GetObject("pbTotal.Image"), System.Drawing.Image).
You can rightclick the picturebox -> Properties-> and there should be an image field with the informations you search
If its not set in the properties window which can be viewed by right clicking on the picture box it will be set in code using the image property.
The PictureBox control gives you two options for setting the image that is displayed on it. You can use the ImageLocation property or the Image property to perform the same task.
If you set the ImageLocation to the file name or url of a valid image/picture, image gets displayed and you can access it via the Image property as well. If you should use the Image property to set the image displayed, there will be no way to know the physical location of the image being displayed if you did not know it beforehand.
From the code you've pasted in your question, there no way way retrieve the path/url to the image file. To further complicate matters, the image is being loaded from your project's resources so any attempt to resolve the path/url would have to first go through the project resources before locating the original file and even if this is possible, for all practical purposes it is too cumbersome.
In short, if you'd like to get the path/url of the image loaded in the PictureBox at some point later, use the ImageLocation property instead of the Image property to set the image to be displayed.
Ok, I just found the true answer. Yes it in a resource file, but not for the project itself. I didn't know that forms themselves have resource files (.resx) as well.
In visual studio 2010 (not sure about the others), the .resx file is hidden. If you click the option to "Show All Files" in the solution explorer tool bar, you'll then see that the form can be drilled down. There in the .resx file, I was able to find my image.