creating text file in wp7 using vb.net - vb.net

I have tried following code:
imports system.io
imports system.io.isolatedstorage
private sub Button_Click(sender as system.object, e as system.windows.routedeventargs) handles button1.click
dim isoStore As IsolatedStorageFile = isolatedstoragefile.getuserstoreforapplication
isostore.createfile("c:\test.txt")
end sub
when i run the code on windows phone emulator it shows exception "Operation not permitted on isolatedstoragefilestream"

Windows Phone is not like a PC operating system, there is no C:\ - each app has it's own contained area where you store and access files, hence the name IsolatedStorage.
GeekChamp has a great tutorial on IsolatedStorage, which is in C#.
For VB.Net, the following code sample should help you getting started with IsolatedStorage:
http://code.msdn.microsoft.com/wpapps/VBWP8ImageFromIsolatedStora-11071695

Related

How to save a changed label when you exit

In my program I have a preview, and edit side.
When you edit using the text boxes on the edit side(right side) and click "save", It should change the label on the right side (preview side). Although when you exit the program and re-open, all the data you entered has disappeared!,
I have tried the below code and had no luck as my result.
Public Class Form1
Private Shared NameBasic As Integer
Public Sub New()
InitializeComponent()
lblNameBasic.Text = Convert.ToString(NameBasic)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
NameBasic = txtFirstBasic.Text
lblNameBasic.Text = Convert.ToString(NameBasic)
End Sub
End Class
Also my goal is to have it be able to take it on a flashdrive onto any computer and have that data still saved within the exe. Is this even manageable? (I am more of a web based programmer so I am a bit new to this)
You need to write values to a text file at the same location of the exe. and read it. you will need both exe and the textfile.
OR
You will need to write a dll on run-time and write some values while closing the application. this will be more secure then the text file. here you will need both exe and dll to be copied into flash drive
OR
the application setting as spoken by others..

How i can run html file iwith vb in visual studio 2008

I tried to run with Process.Start(path of file.html)
Private Sub TestΜαθηματικάIΙIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestΜαθηματικάIΙIToolStripMenuItem.Click
Process.Start("C:\Mathimatika\3o_test_M-III\test.html")
End Sub
but i have this error "The system cannot find the file specified" I'm sure 100% path is correct.
Can anyone suggest me some other way?
thanks in advance
You can get this message if something else prevents your process from opening the file, such as if it does not have permissions to access the file, or if the file is locked by another process.
Also, if you're trying to do this from an ASP.Net web site, remember that your code is running on a web server that will not have access to the file system on computer hosting the web browser.
Looking again: it's just not escaping the \ character in the file path. All you need to do is add a # so that you get an unescaped string:
Private Sub TestΜαθηματικάIΙIToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TestΜαθηματικάIΙIToolStripMenuItem.Click
Process.Start(#"C:\Mathimatika\3o_test_M-III\test.html")
End Sub

VB.NET/Access DataGridView not displaying table contents

I'm attempting to display an Access Database table in a DataGridView on the most simple form you could make. However, when I start the application I don't see any of the table data. See below.
I'm happy to update with any additional information needed.
VB:
Option Explicit On
Option Strict On
Option Infer Off
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MOKANDataSet.SalaryHistory' table. You can move, or remove it, as needed.
Me.SalaryHistoryTableAdapter.Fill(Me.MOKANDataSet.SalaryHistory)
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
Here is the application at runtime.
Overview of project in Visual Studio
I was curious and went directly to the executable in the bin folder. Upon execution, I got "The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. I'm using Win 7 64 Bit, but the Microsoft Office suite I have is 32-bit. I got the 32-bit AccessDatabase Engine referenced here

Porting Crystal Report from VB6 to VB.NET

I have done a tonne of work in porting quite a large VB6 project over to .NET but have hit a snag on the crystal reports. I've converted the dsr files to rpt. The next stage is getting it into the code
The VB6 way was to use the following
Dim report As New cryMyReport
Even after importing the rpt files into the project, cryMyReport is not recognised.
What do I need to do to get my .NET app recognise and use the rpt files?
I often refer people to http://vb.net-informations.com/crystal-report/vb.net_crystal_report_step_by_step.htm
Essentially you need to add the Crystal references (you will need the Crystal reports for visual studio runtimes installed), add a CrystalReportViewer and then use some code along the lines of:
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
End Class

Application to Startup::: Access Error

Hi
I am using following code to add my application to StartUp of Windows. It works well in XP but gives error in Vista that you donot have permission to edit registty file.
Private Sub Forceps_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim regStartUp As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
'Dim value As String
'value = regStartUp.GetValue("Myapp")
'If value <> Application.ExecutablePath.ToString() Then
'regStartUp.CreateSubKey("Myapp")
'regStartUp.SetValue("Myapp", Application.ExecutablePath.ToString())
' End If
End Sub
This is caused by the User Account Control (UAC) feature in Vista. Admininstrators on Vista (and 7 and Server 2008 sometimes) run with a user token that is limited in privileges unless the application explicitly requests them.
Some links to read about UAC and how to configure your application.
http://en.wikipedia.org/wiki/User_Account_Control
http://technet.microsoft.com/en-us/library/cc709691(WS.10).aspx
http://bartdesmet.net/blogs/bart/archive/2006/10/28/Windows-Vista-2D00-Demand-UAC-elevation-for-an-application-by-adding-a-manifest-using-mt.exe.aspx