Create folder in Windows CE - vb.net

I am working on an old application running on a Windows CE device. This is old software that is still in use.
As of now, they need to create the folder on the flash drive (there are no drive letters). My idea was to create the folder if missing. However, it gives an error when creating the directory.
The folder is used to save data for later use.
Any ideas on how create a folder from SW?
Here is my VB code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Directory.Exists("QuaData") Then
Directory.CreateDirectory("QuaData")
End If

Related

Unlocking SQL Compact (.SDF) file when data entry form closes

I have developed a small Stock-Take application that runs on a Windows Mobile 6.5 handheld device & uses a SQL Compact 3.5 (.SDF) data file. I built the application in Visual Studio 2008 using VB.Net and it all works fine up to the point where I need to copy the data file back to the connected PC for further processing. When I close the application data entry form, the data file remains locked and I can't copy it to the PC. In the Form_Closed event, I am issuing Dispose commands for both the TableAdapter and BindingSource, and have also added a Garbage Collect command, see code below, but the data file remains locked.
Private Sub StockCheckForm_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.StockCheckTableAdapter.Dispose()
Me.StockCheckBindingSource.Dispose()
GC.Collect()
MsgBox("Form Closed", , "Stock Check")
End Sub

Closing main form doesn't finish process (only some computers)

The problem is happening on 2 of the company's computers and on a client computer, but we can not identify a pattern.
I was able to reproduce the error using a simple program that only opens an OpenFileDialog. The program must be run by the generated executable itself (NOT by Debug) and it is still running in the background even after closing. Below is the code of the program, along with a link to download the project and a video demonstrating the error.
Code:
Public Class Form1
Private ofdAbrir As Windows.Forms.OpenFileDialog
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ofdAbrir = New Windows.Forms.OpenFileDialog
ofdAbrir.ShowDialog()
ofdAbrir.Dispose()
ofdAbrir = Nothing
End Sub
End Class
As you can see in the code above, I only have one form, so it is not the case that some form remains open and it is also not related to threads running since none is created.
To reproduce the problem, click on Button1, cancel the OpenFileDialog and try to close the form (clicking on X). The form apparently will close, but you will see at task manager that it still running. The big mystery is that this problem does not happens in all computers.
Video: https://drive.google.com/open?id=1sfdVUGQlwYNCQkl1Ht-cJSOb4433sqnT
Project: https://drive.google.com/open?id=1d4oJYUjaaZ9xnRj4CX3HXOQPqwMZmE0V
I couldn't reproduce the problem, but how about using this method:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Using ofdAbrir As New Windows.Forms.OpenFileDialog
ofdAbrir.ShowDialog()
MsgBox(ofdAbrir.FileName)
End Using
End Sub
I've seen the video u posted...It is not your application that is running rather it is the vsHost.exe that is running :)...The problem shouldn't occur if u run the app outside visual studio.
If the problem is still there,just disable Enable Diagnostic Tools while debugging from Tools > Options > Debugging > Uncheck Enable Diagnostic Tools while debugging
Also u can disable Visual Studio hosting service from Project > Project Properties > Uncheck Enable the Visual Studio hosting service

Linking to internal html pages with LinkLabel

Visual Basic:
Trying to get my VB program to run an internal HTML file without it needing to navigate back the the C: drive.
Using:
Private Sub frmMalphite_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LinkLabel1.Links.Add(6, 4, "C:\Users\User\Desktop\Test\Test1\Test2.html")
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
System.Diagnostics.Process.Start(e.Link.LinkData.ToString())
End Sub
I can get the html page to run, however it would not work if I opened the project on another computer, because the absolute path given. Looking for a work around so I don't have to change the path on every computer I use to work on the project.
If the file exists on a drive on MachineA, then the only way you can open this from MachineB is to put the file on a shared drive and access the file via this share.
This will work from any machine that has permissions to read that share.
Something like:
LinkLabel1.Links.Add(6, 4, "\\MachineA\SharedDrive\Test2.html")
You may have access to the hidden administrative share on MachineA (\\MachineA\c$) from MachineB but you can't rely on it.

how to make a simple webapp for sending mail or wall using vb.net

I want to make myself a simple webapp using vb.net.I am trying to make a desktop app by which users can login and send mail or post wall(facebook) with out going into the browser. I have created the forms and all other thing using this tutorial( http://howtostartprogramming.com/vb-net/vb-net-tutorial-41-website-login/ ).This original code is working properly.
I have two problems.
1)I have made some changes of my own to the above code; to click_botton1 i have added this code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate("http://login.yahoo.com/")
WebBrowser1.Document.GetElementById("login").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById(".save").InvokeMember("click")
End Sub
but this code is showing error in vb.net(not compiling)
2)After login i want to go straight to the "compose mail page" with out browsing in the web browser window. So i have added this code to the original code.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Document.GetElementById("login").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById(".save").InvokeMember("click")
'NEWCODE'
webBrowser1.Navigate("http://in.mg50.mail.yahoo.com/neo/launch?.rand=de5jqdp66atmb")
End Sub
but this code is showing error. It will not go to the compose page but will redirect to login page(may be problem with cookies).
how i circumvent this problems
Advance thanks for help
I think a better approach would be to use .Net's System.Web.Mail class.
You will find plenty of resources if you Google it. You will need some simple things like the Yahoo (or other) SMTP server name and the account login info.
This approach will also be immune to changes in the Yahoo mail web page.

Getting Current Song Data From Windows Media Player 12

I have been searching all over for an answer to this, and I'm figuring there is no way to do it, but I thought I'd ask.
I'm looking to make a VB.net app that gets and displays the artist and title of a song playing in Windows Media Player. I'm not looking to embed the player in my app, just pull data from the already existing window.
Most of the stuff I find on how to do this is old or related to embedding WMP. I'm looking to do it in with MWP12. I've also seen references to using AxWindowsMediaPlayer.currentMedia Property, but that doesn't seem to work anymore. I used to be able to pull the data from the Registry, but it seems Microsoft took that away.
I've tried sooooo much other code, but this is currently what I have. I'm at my wits end.
Imports WMPLib
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wmp As WindowsMediaPlayer = New WindowsMediaPlayer
Dim playlist As IWMPPlaylist = wmp.currentMedia.???????(????).Item(?)
Label1.Text = playlist.getItemInfo("Title")
End Sub
End Class
No idea where to go here, but thanks for any help.