|
You can start by dragging a button onto your form, then change its Text property to "&Save". Double-click the button to open the code editor, then start writing your code to save whatever you need to save. That part really depends on what your trying to save and where, though...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i have excel sheet with lot of columns, i want to transfer that data to SQL Server 2000 dynamically(Througn VB.Net), Please help me if any sql queries are these to read the excel-sheet data....
Ex: select name,no from [sheet1$] These type of queries i want...
Or otherwise any solution is there or not.....
Please reply..
Regards
Murthy
|
|
|
|
|
i have just install the VB2005 Express edition, i'm thinking to convert my VB6 program to it, and recently i'm using the ACcess.
Is it possible to convert table in it too? or i have to recreate it again in vb2005?
|
|
|
|
|
You can use Access DBs in VB.NET. I'm not sure if there's an automated conversion available.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Access has an Upsizing Wizard to help with this (Tools/Database Utilities/Upsizing Wizard). It's definitely NOT perfect. It's primary use is to migrate the database and as much SQL procedures as possible, but not everything can be converted, especially if you stuff that depends on VBA.
I consider this to be an interrim solution. Your better solution is to recode the database to take advantage of the features SQL Server has and Access lacks. You'll probably also have to record the data layer of the application.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
There are 500 pages in .doc file. Every page contains 3 images (Signature,Phtoo and Address) and 1 text field (Roll Number). All the 3 images and 1 text field are at the fixed position. I want to export or save these data in a table i.e. there will be a table with 3 images and 1 text field (Signature, Photo and Address all image field and 1 text field Rollno); so that i can print a specific document using that table.
Please guide me in detail or if u kindly tell me any link about solving this issue.
Thanks in advance
Girish
|
|
|
|
|
My VBA code in Access uses MS Forms 2.0 Object Library, specificly GetText(), and works well. But when I turn off the computer and turn it back on again, the VBA code errors at GetText(). With MS Forms 2.0 checked in the reference table, what could be the problem?
Thank you
|
|
|
|
|
Guys,
just wanted to know what you think about this. what are the pros and cons, methods that could help for faster execution or loading time.
Pros...
1. Don't have to migrate the whole application or start from scratch.
.
.
.
Cons...
1. very slow. (bindings, loading of controls)
.
.
.
|
|
|
|
|
|
Hi,
Anyone know how to get SMS notification once a new message is received??? A notification or messagebox is fine with me as long as there is something pop up to tell the user there is a new SMS...I can send SMS and receive already so basically just left the notification part which leaves me bothering...Hope someone can help me with it...Thanks...
|
|
|
|
|
I am looking for suggestions on how to detect if my database is online. I know I want to put a function in place to see if I can poll of DB Server on startup based on the connection-string in my app.config file.
I just am not sure of the right way to do it. Any Suggestions? I just need a general thought processs, I can do the finer grained stuff.
Thoughts?
Thanks;
David
You are only as good as your last project.
|
|
|
|
|
Simply try to connect to it. If the connection fails, the database isn't "online".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a simple project that i am trying to figure out how to complete.
I have a .txt file that I am reading from. I would like to be able to read it into a RTF control change the text around and save it back.
I was trying to make a shortcut and delete the file then create it and write the information from the RTF box or a stored string variable but no luck...something is holding the file open and I cannot figure out what it is.
Code is below.
Public Class Summary<br />
Dim path As String = Application.StartupPath & "\"<br />
Dim fileName As String = "ChangeLog.txt"<br />
Dim MyString As String<br />
<br />
Private Sub Summary_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Dim Sr As New IO.StreamReader(path & fileName, True)<br />
<br />
Sr.BaseStream.Seek(0, IO.SeekOrigin.Begin)<br />
<br />
Do While Sr.Peek > -1<br />
MyString = Sr.ReadToEnd<br />
Loop<br />
With rtSummary<br />
.ReadOnly = True<br />
.Text = MyString<br />
End With<br />
Sr.Close()<br />
<br />
End Sub<br />
<br />
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnSave.Click<br />
Dim Sw As New IO.StreamWriter(path & fileName, False)<br />
<br />
If IO.File.Exists(path & fileName) Then<br />
IO.File.Delete(fileName)<br />
IO.File.Create(fileName)<br />
Sw.WriteLine(vbCrLf & MyString & vbCrLf & rtSummary.Text)<br />
Sw.Flush()<br />
Sw.Close()<br />
Else<br />
IO.File.Create(path & fileName)<br />
Sw.WriteLine(vbCrLf & rtSummary.Text)<br />
Sw.Flush()<br />
Sw.Close()<br />
End If<br />
Me.Dispose()<br />
End Sub<br />
<br />
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnEdit.Click<br />
rtSummary.ReadOnly = False<br />
End Sub<br />
<br />
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnClear.Click<br />
rtSummary.Clear()<br />
End Sub<br />
<br />
Private Sub Summary_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing<br />
If rtSummary.Text IsNot "" Then<br />
<br />
End If<br />
End Sub<br />
End Class
I know that some of this has no relevance to the problem but i thought i would include it nonetheless. What is holding the fle open so i cannot delete it. Or...is there a better way to accomplish what I am trying to accomplish?
Thanks in advance.
Thanks,
Taen Karth
|
|
|
|
|
Can you describe what is happening?
Is your textbox getting the text?
Your Sr.ReadToEnd should not be in a loop, since you are not reading each line...you are already reading the whole stream in one hit!
You should also close the SteamReader as soon as you have finished with it. Before you do anything with the data retrieved...
Steve
-- modified at 14:54 Monday 14th August, 2006
|
|
|
|
|
Well that sure makes sense!...hehe
My RTF box IS in fact gettnig all the text, What is happening is that when it gets to the line:
IO.File.Delete(fileName)
It states that it cannot perform the action because the file requested is still in use.
Loop removed.
Thanks,
Taen Karth
|
|
|
|
|
You don't have the file open in another app do you?
Notepad or Word etc?
Steve
|
|
|
|
|
Nope.
Thanks,
Taen Karth
|
|
|
|
|
You only have 'filname' for the file to delete.
Shouldn't this be 'path & filename'?
If you are always going to delete the file anyway, you don't have to check whether it exists first. Just code for deleting the file. An exception will not be generated if the file doesn't exist...
Then try using the CreateText method of the IO.File class.
What is that Me.Dispose() supposed to be doing?
Steve
-- modified at 15:26 Monday 14th August, 2006
|
|
|
|
|
Put your StreamWriter contstructor AFTER your File.Create line.
I think this is holding the file open.
You should only put this after you have created the file!
Steve
-- modified at 15:37 Monday 14th August, 2006
|
|
|
|
|
Ok tried that and still getting this error message:
The process cannot access the file 'C:\Documents and Settings\troy\Desktop\Projects\ChangeLogger\ChangeLogger\bin\Debug\ChangeLog.txt' because it is being used by another process.
This is what the "Save" event looks like now:
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnSave.Click<br />
Dim Sw As New IO.StreamWriter(path & fileName, False)<br />
<br />
<br />
IO.File.Delete(path & fileName)<br />
IO.File.CreateText(path & fileName)<br />
Sw.WriteLine(vbCrLf & MyString & vbCrLf & rtSummary.Text)<br />
Sw.Flush()<br />
Sw.Close()<br />
<br />
Me.Dispose()<br />
End Sub
Any ideas? btw thanks for the suggestions so far!
Thanks,
Taen Karth
|
|
|
|
|
The StreamWriter constructor must be moved to here:
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnSave.Click<br />
<br />
IO.File.Delete(path & fileName)<br />
IO.File.CreateText(path & fileName)<br />
Dim Sw As New IO.StreamWriter(path & fileName, False)<br />
Sw.WriteLine(vbCrLf & MyString & vbCrLf & rtSummary.Text)<br />
Sw.Flush()<br />
Sw.Close()<br />
<br />
End Sub
I have also removed the Me.Dispose() line.
If you want to do that, do it in the form's closed event handler.
Steve
|
|
|
|
|
Still the same "File is in use" error as before...
Thanks,
Taen Karth
|
|
|
|
|
Jeez...now I get that error on this line:
Dim Sw As New IO.StreamWriter(path & fileName, False)
and I do not get any errors on the two lines right before it that create adn delete the file.
Thanks,
Taen Karth
|
|
|
|
|
Sorry. I forgot to move the other line. Should be like this:
Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbtnSave.Click<br />
<br />
IO.File.Delete(path & fileName)<br />
Dim Sw As IO.StreamWriter = IO.File.CreateText(path & fileName)<br />
Sw.WriteLine(vbCrLf & MyString & vbCrLf & rtSummary.Text)<br />
Sw.Flush()<br />
Sw.Close()<br />
<br />
End Sub
Steve
|
|
|
|