|
yes that's what i meant to save the program. isn't there a code like application.save (i know that it doesn't exist) or some sort of thing?
luke
|
|
|
|
|
No, there isn't. There's no way to save the "application state" automatically.
You have to write the code that will serialize your applications internal database (you ARE using some kind of storage to track these controls, right?) and save the information your application needs to recreate the database.
I think you're using label controls that the user can move around? How are you tracking these controls? How many controls are you allowing for? What's the bare minimum information you need to recreate each of these controls? This is the information your code will have to write to a file so you can read it back in the next time the user wants to load this "project".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello there,
i have a question.
i'm creating an arena configuration application. i have used this code to drag a label round a form.
dim dragging as boolean<br />
dim startx, starty as integer<br />
<br />
then on the mouseclick i set the dragging to true and so on...
now i want to create labels at runtime ( i know how to do that already), but my problem is how to create an addhandler for dragging.....
any ideas or code please?
luke
|
|
|
|
|
this should help: http://www.thescarms.com/dotnet/EventHandler.asp
Nathan Lindley
|
|
|
|
|
|
Cool.
Bookmarking this one.
|
|
|
|
|
Hi
i am facing a problem.
I am working with Visual basic 2005 and Sql Server 2000. I 've created an ODBC for the SQl database.
I have.'add' and 'save' buttond and 'edit' and 'update' buttons and delete, first, next, previous and last.
i wrote the following code. its not working for 'update and 'delete', giving me the following error
INVALID OPERATION EXCEPTION WAS HANDLED
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
But the same code is working for access table, imean for update also.
Somebody please help
Also tell me hw can i use ggrid in Vb2005 for display and edition?
Imports System.Data
Imports System.Data.OleDb
Imports system.Data.Odbc
Imports System.Data.Odbc.OdbcCommand
Public Class Form1
Dim con As New Odbc.OdbcConnection
Dim da As New Odbc.OdbcDataAdapter
Dim ds As New DataSet
Dim maxRows As Integer
Dim inc As Integer
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Clear()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "dsn=alphasql"
con.Open()
da.SelectCommand = New OdbcCommand("Select * from Company", con)
da.Fill(ds, "Company")
maxRows = ds.Tables("Company").Rows.Count
inc = -1
End Sub
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
Close()
End Sub
Private Sub cmdFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFirst.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
Else
MsgBox("This is the first Record")
End If
End Sub
Private Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
con.Close()
con.Open()
da.SelectCommand = New OdbcCommand("Select * from Company", con)
da.Fill(ds, "Company")
'maxRows = ds.Tables("Company").Rows.Count
'Dim cb As Odbc.OdbcCommandBuilder = New odbccoom(da)
Dim builder As OdbcCommandBuilder = New OdbcCommandBuilder(da)
ds.Tables("Company").Rows(inc).Item(0) = txtSlNo.Text
ds.Tables("Company").Rows(inc).Item(1) = txtCode.Text
ds.Tables("Company").Rows(inc).Item(2) = txtCompanyName.Text
ds.Tables("Company").Rows(inc).Item(3) = txtCompType.Text
ds.Tables("Company").Rows(inc).Item(4) = txtRegNo.Text
ds.Tables("Company").Rows(inc).Item(5) = CDate(dtpRegDate.Value)
ds.Tables("Company").Rows(inc).Item(6) = CDate(dtpRegExpDate.Value)
ds.Tables("Company").Rows(inc).Item(7) = txtComRegNo.Text
ds.Tables("Company").Rows(inc).Item(8) = txtActivity.Text
ds.Tables("Company").Rows(inc).Item(9) = txtOwner1.Text
ds.Tables("Company").Rows(inc).Item(10) = txtOwner2.Text
ds.Tables("Company").Rows(inc).Item(11) = txtOwner3.Text
ds.Tables("Company").Rows(inc).Item(12) = txtOwner4.Text
ds.Tables("Company").Rows(inc).Item(13) = txtOwner5.Text
ds.Tables("Company").Rows(inc).Item(14) = txtCapital.Text
MsgBox("Data updated")
MsgBox(ds.Tables("Company").Rows(inc).Item(2))
'ds.Tables("Company").GetChanges()
da.Update(ds, "Company")
MsgBox("COMPLETED")
End Sub
Private Sub NavigateRecords()
txtSlNo.Text = ds.Tables("Company").Rows(inc).Item(0)
txtCode.Text = ds.Tables("Company").Rows(inc).Item(1)
txtCompanyName.Text = ds.Tables("Company").Rows(inc).Item(2)
txtCompType.Text = ds.Tables("Company").Rows(inc).Item(3)
txtRegNo.Text = ds.Tables("Company").Rows(inc).Item(4)
dtpRegDate.Value = ds.Tables("Company").Rows(inc).Item(5)
dtpRegExpDate.Value = ds.Tables("Company").Rows(inc).Item(6)
txtComRegNo.Text = ds.Tables("Company").Rows(inc).Item(7)
txtActivity.Text = ds.Tables("Company").Rows(inc).Item(8)
txtOwner1.Text = ds.Tables("Company").Rows(inc).Item(9)
txtOwner2.Text = ds.Tables("Company").Rows(inc).Item(10)
txtOwner3.Text = ds.Tables("Company").Rows(inc).Item(11)
txtOwner4.Text = ds.Tables("Company").Rows(inc).Item(12)
txtOwner5.Text = ds.Tables("Company").Rows(inc).Item(13)
txtCapital.Text = ds.Tables("Company").Rows(inc).Item(14)
End Sub
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
If inc <> maxRows - 1 Then
inc = inc + 1
NavigateRecords()
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub cmdPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrevious.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
Else
MsgBox("First Record")
End If
End Sub
Private Sub cmdLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLast.Click
If inc <> maxRows - 1 Then
inc = maxRows - 1
NavigateRecords()
Else
MsgBox("Last Record")
End If
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
'inc = 0
'NavigateRecords()
MsgBox(inc)
'If inc <> -1 Then
Dim cb As New Odbc.OdbcCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Company").NewRow()
dsNewRow.Item("SlNo") = txtSlNo.Text
dsNewRow.Item("Code") = txtCode.Text
dsNewRow.Item(2) = txtCompanyName.Text
dsNewRow.Item(3) = txtCompType.Text
dsNewRow.Item(4) = txtRegNo.Text
dsNewRow.Item(5) = CDate(dtpRegDate.Value)
dsNewRow.Item(6) = CDate(dtpRegExpDate.Value)
dsNewRow.Item(7) = txtComRegNo.Text
dsNewRow.Item(8) = txtActivity.Text
dsNewRow.Item(9) = txtOwner1.Text
dsNewRow.Item(10) = txtOwner2.Text
dsNewRow.Item(11) = txtOwner3.Text
dsNewRow.Item(12) = txtOwner4.Text
dsNewRow.Item(13) = txtOwner5.Text
dsNewRow.Item(14) = txtCapital.Text
ds.Tables("Company").Rows.Add(dsNewRow)
da.Update(ds, "Company")
MsgBox("New Record added to the Database")
ds.Reset()
'End If
End Sub
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
Dim cb As New Odbc.OdbcCommandBuilder(da)
ds.Tables("Company").Rows(inc).Delete()
maxRows = maxRows - 1
inc = 0
NavigateRecords()
da.Update(ds, "Company")
End Sub
Private Sub Clear()
txtSlNo.Text = ""
txtCode.Text = ""
txtCompanyName.Text = ""
txtCompType.Text = ""
txtRegNo.Text = ""
txtComRegNo.Text = ""
txtActivity.Text = ""
txtOwner1.Text = ""
txtOwner2.Text = ""
txtOwner3.Text = ""
txtOwner4.Text = ""
txtOwner5.Text = ""
txtCapital.Text = ""
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
|
|
|
|
|
binujeesman wrote: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
I'm guessing you haven't specified a primary key field in your table adapter/dataset.
binujeesman wrote: Also tell me hw can i use ggrid in Vb2005 for display and edition?
ggrid?
Why have you posted all the code from Form1? Surely you can narrow the problem down a bit?
|
|
|
|
|
but please tell me hw can i specify a primary key field in your table adapter/dataset.
its data grid what i meant.
pleaase help
|
|
|
|
|
A Primary Key is a field the uniquely identifies each record in a table. You have to add this field to your database tables, then update your application code accordingly.
If you don't know what a Primary Key is and its purpose, you really need to stop this project and learn relational database basics before you continue with this project. Google results for "database primary key[^]".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hi,
How to incorporate English dictionary in VB 6.0
Actually i want avoid spelling mistek in text box or any componant.
Please Help::
Thank U
-- modified at 6:20 Thursday 2nd November, 2006
|
|
|
|
|
The best way to do this is to use a 3rd party component to supply the dictionary functionality. Google for "vb.net spellcheck textbox[^]".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
i have searched for a long time with no result, about this subject. I need to open a web page and give the values for the textfields(user,pass) by code.
With System.Diagnostics.Proccess.Start(filename, user, pass, domain) i take an win32 exception(I cant find why!)..I try to open a site which the username & password isnt remebered (http://www.managerzone.com/index.php?lang=en&changesport=soccer).
Also, I want to make handle events on this page...like the click of a button..
Can you help me?
Thanx in advance..
Kostas
|
|
|
|
|
The Process class will only launch the process (browser) in your case. You can't supply your site username and password to the Process class because it's expecting the credentials to launch the new process under. Kind of like "Run As". They have nothing to do with the website you're logging into.
Now, it's possible, however very unreliable, to launch the browser and have your code find the credentials window that pops up, and send the appropriate window messages to it to simluate the keystrokes to fill in those two blanks. But, THIS IS VERY UNRELIABLE.
Handle what events???
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
"Handle": I mean to make the click event of the button "loggin", for example!
Ok, thanx a lot for the advise!
|
|
|
|
|
How to extract file from e-mail automatically? and how to read the file? tq
SaM
|
|
|
|
|
You're going to have to explain how your getting this email first. Are you using Outlook, or some other mail package to do it? Did you implement your own STMP/POP3 clients? Did you use a 3rd party component to get the email?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you for your attention. Actually I want to use Yahoo! Mail or Outlook as a platform for extracting the file. Once I receive the e-mail, the program will read and extract the file automatically. Then, the file will be used for updating database(MapObjects+ArcView). What should I begin with?
SaM
|
|
|
|
|
First, you shouldn't be relying on Yahoo Mail, or any other application to do this for you. Yahoo Mail's user interface can, and will, change from time to time, rendering your code absolutely useless.
There are major issues with controlling the user interface of another application. I know, every newbie thinks it should be a piece of cake to do, but they simply do not understand how a UI works and therefore can't understand why it's so difficult to do. You simply do NOT do it if you want to write rock solid code.
If you're using VB.NET 2004, you can use the System.Web.Mail namespace to create your own email client, complete with the ability to unpack attachments. If your using 2005, then the System.Net.Mail[^] namespace has everything you need to download mail from an SMTP server and unpack attachments.
I HIGHLY recommend using the .NET Framework 2.0 to do this. It's email handling support is FAR better than the support offered by the .NET Framework 1.x.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
oh i see...ermm, do you have any script sample on how to use system.Net.Mail?
SaM
|
|
|
|
|
Hi..
Anyone could help me out in writing a vb.net windows application, which converts the given numbers to appropriate words(Ex.if 123 is entered,the output should be ONE HUNDRED AND TWENTY THREE)
Vijay Mesa
|
|
|
|
|
|
That sounds like a homework assignment to me... If it is, assume your lecturer is also reading these boards.
|
|
|
|
|
You must construct an algorithm to do this routine!
It will starts from the end of the integer..and reads one by one the numbers!
You must call two functions. First returns the number string (ex. 1 one), and second the "position" (if this number is 3rd from the end this is hundred).
It's too easy..
Kostas
|
|
|
|