|
yes its ment for a game but i would like to use it for other things too if possible.
how would i set up a small database to read and write from ?
Please Keep in Mind if you explain it to me...
im still new to VB even though ive been doing it almost a year .... i have only done super simple projects and now im trying to challenge myself to see if i can do better stuff or not. I make things for people i know in person so i can hand them the project on a flash drive. I Hope to get good enough to write something like Microsoft paint in VB not C# or C++ or any other language at the moment. I do want to learn C# one day just waiting till im up to intermediate/Advanced level with VB so as to not get too far ahead of myself.
idea of my skill level if it helps. I wrote my own tic-tac-toe game to play against myself. if i went in spot 1 it would auto move to spot 2,4, or 5 and if i move to spot 5 first it would move to spot 1,2,3,4,5,6,7,8, or 9. it all depends on where i move for its next move.... not the best work ive made but almost.
please dont use big o' computer programmer word(s) i have to google to know what they mean unless you cant help yourself.
Thank you and ill be waiting for a reply
|
|
|
|
|
I got ticked off yesterday for not using big ol' computer words. You just can't win!
Are you using VB Express or the full Visual Studio version?
modified 21-Jun-12 19:29pm.
|
|
|
|
|
Ok, here we go. All the code you need to set up a simple database and a subroutine to add new records to which you can pass values without the need to change any existing code. You need to add a DataGridView for display. It's not the most elegant but it's the easiest to set up. When you're familiar with the code you can try something more sophisticated.
Imports ADOX
Public Class Create
Dim DBSet As New DataSet
Dim DBAdaptor As OleDb.OleDbDataAdapter
Dim DBTable As DataTable
Dim DBView As DataView
Dim DBCon As New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = ScoreDB.mdb")
Dim DBCommand As OleDb.OleDbCommandBuilder
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
If Not My.Computer.FileSystem.FileExists("ScoreDB.mdb") Then
Dim DBCat As New Catalog()
DBCat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=ScoreDB.mdb;" & _
"Jet OLEDB:Engine Type=5")
Dim DBCmd As New OleDb.OleDbCommand("CREATE TABLE [High_Score] ([Name] TEXT(30), [Score] NUMERIC(10))", DBCon)
DBCon.Open()
DBCmd.ExecuteNonQuery()
DBCon.Close()
End If
DBCon.Open()
Dim DBAdaptor As New OleDb.OleDbDataAdapter("SELECT * FROM High_Score", DBCon)
DBAdaptor.Fill(DBSet, "High_Score")
DBCon.Close()
Dim DBView As New DataView(DBSet.Tables(0))
DBView.Sort = "Score DESC, Name ASC"
DataGridView1.DataSource = DBView
End Sub
Private Sub DataUpdate(ByVal Name As String, Score As Integer)
Dim DBAdaptor As New OleDb.OleDbDataAdapter("SELECT * FROM High_Score", DBCon)
Dim DBCommand As New OleDb.OleDbCommandBuilder(DBAdaptor)
Dim DBRow As DataRow
DBRow = DBSet.Tables("High_Score").NewRow()
DBRow.Item("Name") = Name
DBRow.Item("Score") = Score
DBSet.Tables(0).Rows.Add(DBRow)
DBAdaptor.Update(DBSet, "High_Score")
End Sub
End Class
|
|
|
|
|
Sorry i've been away awhile.
Thank you For the help i will use this and try to become familiar with your code. After i'm familiar with your code i will try to make one of my own similar to yours if possible.
[SOLVED]
|
|
|
|
|
I use the FULL Visual Studio Version . soo glad i got it a long time ago it said $11,000 on the Ultimate Version on it the other day.... i was like WTF!!?? when did that happen lol but yes i have the full version and it works Great.
|
|
|
|
|
Hi people
I have a desktop vb.application that make a logon on to a server application.
In case of successfull logon session is set (or at least I suppose it is). This code is a webservice public function linked to VB.NET as webservice Reference
Public Function Login_Click(stringa, azienda)
Dim conn As OdbcConnection
Dim comm As OdbcCommand
Dim dr As OdbcDataReader
Dim Sql As String = stringa
Dim ritorno As Boolean = False
conn = New OdbcConnection(connectionString)
Try
conn.Open()
comm = New OdbcCommand(Sql, conn)
dr = comm.ExecuteReader()
ritorno = dr.Read
If dr.Read() Then
'create sessions
Session("ID") = dr.GetString(0) *That's the userid
Session("DateTime") = DateTime.Now.ToString()
Session("company") = azienda
Session("blacklist") = dr.GetString(2)
End If
Now, from another VB.NET application I wish to check the users who logged on. So as webservice reference I tried something like this, but it doesn't work:
<webmethod()> _
Public Function checkSession(id) As Boolean
Dim answer As Boolean
MsgBox(Session.Item(id))
If Session.Item(id) Is id Then
answer = True
Else
answer = False
End If
Return answer
End Function
My expectation was that VB.NET application get the user state, but an error happens.
Regardless my implementation, any suggestion from you in order to get the information that i need ?
Anybody so kind to give me an hand ?
Thanks a lot \\ Antonio
|
|
|
|
|
There is no such thing as a Session in a desktop app.
You can create your own implementation of this though. Your logins would have to be stored in a database of some kind. Off the top of my head, the application sends the username and password to your server code when it is authenticated. If it passes authentication, it sends back a GUID that is also logged into the database as being an active login.
Once you have that data, your other app can request all the active logins from the database.
Your server code will also have to implement a logout method to remove the GUID passed to the client. The client could just pass the GUID to let it know it wants to log out.
Your server code will also have to maintain the active login database by clearing out stale records where a timeout value has expired. Theis prevents the database from being loaded up with dead login data where the client logged in, but never logged out for some reason.
|
|
|
|
|
Hi Dave
Thanks a lot for your reply.
I was supposing that session stuff doesn't require any interwork with db. If I store into the DB my loggin state it's much easer but it doesn't sound as implementation of session functionality either.
Please forgive me, I suck as designer, but I supposed that session functionality allows the user to keep available information without accessing to the DB.
Regarding timeout, how can I keep track of inactive users logged in my DB without a session mechanism ?
I suppose that I should implement a sort of tread which performs a continuos scan of users table.
Honestly, I'm a bit surprise because I belived that to start a session from 1 side using a webreference class which set 'session("my_session")=1' was enough.
The other desktop application use another webreference class which can read the state of a specific session if this way
'if session("my_session")=1
return true
Most probably session mechanism works very differently of my understanding
|
|
|
|
|
ilgrongo wrote: I belived that to start a session from 1 side using a webreference class which
set 'session("my_session")=1' was enough.
Desktop apps have no such concept as a "session". They only exist in web applications (ASP.NET) and that mechanism can be used by web services to manage session state.
For a web service, sessions do exist. But, session data (and the "Session" object) only exist in the server-side code. The desktop application cannot reference Session at all.
|
|
|
|
|
Thanks again Dave
Sorry It was my fault, sometime I can't express myself properly.
So far,I didn't write a single line of code desktop side trying to manage session, modificate session data and so on.
What I'm struggling with is just the retriving of session information from server side to be used.
On desktop side I'm writing code like this:
Dim webConsumer As New localhost.WebService1
If webConsumer.checkSession(userid) = 1 Then
.....do something.........
Where webConsumer is the instance of object WebService1
Thanks a lot
|
|
|
|
|
WITHOUT using msgina.dll or any DLL file / hooks... Is there a way to disable CTRL ALT DEL keys and the Win Key ?
The app im working on now has a timer to keep it ontop. it is password enabled to both lock and unlock it so random kids cant lock or unlock the PC without the password. i made the app so it can not be shutdown with the ALT+F4 keys, it is borderless, and FILLS the whole screen.
This Program would be a big hit on my website.
ill give credit to all that help in the code if asked.
|
|
|
|
|
There is no way at all to disable Ctrl-Alt-Delete. And Windows already has a lock screen built into it that will always be more secure that your app.
In order to disble the Windows key, you'll have to write a global keyboard hook. There's tons of examples of this all over the web, you need only to Google for "VB.NET keyboard hook" to find them.
BTW, the keyboard hook trick will NOT work for Ctrl-Alt-Del.
Windows Vista and 7 do not use GINA. GINA was retired with Windows XP and a new model was put into place that offers more flexibility and extensibility, called Credential Providers.
|
|
|
|
|
yes i agree with you... "Windows already has a lock screen built into it that will always be more secure that your app." but i want a program that acts almost the same but allows me to run programs . windows 7 lock on my PC will not allow me to run some of my programs while its in use. im goal is to make an app to allow me to run program and act in place of windows lock.
|
|
|
|
|
Unless your descriuption is missing a crucial little detail, the Lock Screen doesn't prevent your apps from running at all. You can run anything you want, then lock Windows whenever you want. The only exception to that would be some games.
|
|
|
|
|
Member 8768189 wrote: The app im working on now has a timer to keep it ontop. it is password enabled to both lock and unlock it so random kids cant lock or unlock the PC without the password. i made the app so it can not be shutdown with the ALT+F4 keys, it is borderless, and FILLS the whole screen.
If it's used to protect your environment against kids, then by all means, simply use the account-control that comes with Windows. It provides in a safe password-storage and a safe environment.
These type of questions often benefit from additional background-information, such as the version of Windows that you're targetting. If you're merely looking for your own environment then open your own desktop[^].
Bastard Programmer from Hell
modified 16-Jun-12 17:11pm.
|
|
|
|
|
404 Alert!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
tx
|
|
|
|
|
ill give it a try. Thank you.
im going to attempt to make my own environment and see how that works out. ive never tried that so any tips would be great and thank you for your GREAT idea
i want this app for myself and many many others and its to keep all people off not just kids.
|
|
|
|
|
Member 8768189 wrote: i want this app for myself and many many others and its to keep all people off not just kids.
Even for adults; the best way to secure the desktop is by using the built-in provider.
It's fun to play with alternatives to the default logon, but it doesn't make it more secure. I'd be in that system before you finished peeling a banana.
Bastard Programmer from Hell
|
|
|
|
|
How would i go about using the built-in provider?
I have Windows 7 and if i can use this app to do something like what your talking about then how would i go about doing it?
|
|
|
|
|
I was talking about the standard Windows-7 logon-screen; you can create users in Windows, and it'll do the verification for you.
Bastard Programmer from Hell
|
|
|
|
|
Member 8768189 wrote: This Program would be a big hit on my website.
How exactly would it be able to lock the PC if it's web based?
|
|
|
|
|
I think he's talking about distributing the thing on his web site.
One minor little flaw in his marketing plan. For something seemingly simple in functionality, why don't you see this kind of app all over various web sites already??
There's probably a reason for it...
|
|
|
|
|
its not web based. Sorry if i made it seem as if it was ... when i said app i ment it as in application ... if thats what threw you off.
|
|
|
|
|
not web based i ment app as in application
|
|
|
|