|
supercat9 wrote: (defining hex2, hex4, and hex8 functions).
Why?? Why not just write a single function that take the number of places as a parameter??
supercat9 wrote: since computing hex8 requires generating three temporary strings
Why?
|
|
|
|
|
\ is a valid operator in vb6
|
|
|
|
|
It's been sooooo long since I've touched VB6. Thankfully...
|
|
|
|
|
ya i still have to on occasion
In the past I used it to know if a number was even.
If Val \ 2 = Val / 2 Then
'even
Else
'odd
End If
|
|
|
|
|
When my programme starts I first display a login screen and then if the right user and pass are entered I open my main screen.
Untill now I'v been hiding the login screen (and it works fine) but I would like to close it.
Since this screen opens another form it gives an error:
An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss.
anyone know how I can close the login screen (who is the startup form) and open another form.
I don't want to open my main form and open the login ontop (showdialog).
any help will be apriciated
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
Don't make your Login form the startup form. Instead, create your own Sub Main and set your applications startup object to that.
In there, you'll launch your login form where you get the user credentials and authenticate them. Your form should then kill itself (Application.Exit) returning control to your Sub Main.
In your login form, you can expose some properties that tell if the user was successfully authenticated and a property or two identifying the user.
In your main application form, you can create a Sub New that takes the user credentials as parameters, or whatever else you want.
<STAThread()> _
Shared Sub Main()
Dim loginForm As New LoginForm()
Application.Run(loginForm)
If loginForm.Authenticated Then
Dim myApp As New MainForm(loginForm.Credentials)
Application.Run(myApp)
End If
End Sub
|
|
|
|
|
I'm developing a programme where the user needs to login.
How it should work:
the programme starts and makes a connection to the db (with a standard user and pass) reads the table users and puts that table into a datatable.
once the user has provided his login and pass (and they exist) a new connection to the db is made with the his login and pass (they are created in SQL server), after this only the users connection is used to access the db (that way we can always know who is connected)
this all works and the programme works fine but when I check the connections to the db (in SQL server) it says that there are still 2 connections (per user). Now I don't like this since this programme is going to be used by 10+ users that would mean there are already 20+ connections (I know that that is now problem for SQL but it just isn't how it is supposed to work) and there are also many other db's hosted onto the server so the less connections the better.
following is the code that I use to get the users from the db:
Public Shared Function ExecSqlInDatatable(ByVal Sql As String, ByVal connstring As String) As DataTable
Dim dt As New DataTable
Try
Dim da As New SqlDataAdapter(Sql, connstring)
da.Fill(dt)
'da.Dispose()
'da = Nothing
Return dt
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return dt
End Function
this code works but the connection to the db is maintained.
Any idea why??
Adding the da.dispose and da = nothing didn't help (that's why they are in comment)
any help/idea would be appriciated
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
TDDragon wrote: this all works and the programme works fine but when I check the connections to the db (in SQL server) it says that there are still 2 connections (per user).
Yes, it is the connection pooling. It is faster to get an existing connection out of the pool than create a new one, so once a connection is created for the first time it will be returned to the pool once it is finished with.
TDDragon wrote: Now I don't like this since this programme is going to be used by 10+ users that would mean there are already 20+ connections (I know that that is now problem for SQL but it just isn't how it is supposed to work) and there are also many other db's hosted onto the server so the less connections the better.
It sounds like what you actually need is some sort of service interface to sit between your application and SQL Server (in order that you are only using one pool of connections to the database). If performance isn't so critical you can look at turning the pooling off (Not something I can remember how to do - it's been a few years since I last looked at that)
|
|
|
|
|
How read a barcode from scaner?
Plz Help me.
|
|
|
|
|
Hi
You Need an object that connect to barcode device
and usually have an event for alert to you when action.
that object Depend on device
you would provide that from manofactor of device
contact by barcode company
|
|
|
|
|
You need to consult the documentation of the scanner to figure this out. See if there is an SDK available for your scanner and read the documention on it if there is one.
|
|
|
|
|
Barcode scanners normally work like a normal keyboard, you just need to trap the event for 'Enter' being pressed in your textbox (or whichever control you're using), which is sent after the end character of the barcode is scanned.
I'm not saying it works for all scanners, though it has in the one's I have tried
|
|
|
|
|
Yeah, I know that. I also know that he hasn't specified anything about which scaner he's using. It could be a keyboard wedge, serial, USB, or ethernet based unit, only about half of which act like a keyboard.
|
|
|
|
|
How can I remove the [X]-close Button on the message box?
|
|
|
|
|
I got the answer..
I'll just show a pseudo code here..
It's something like (I'm not sure exactly the code in VB.Net
msgbox("Hello", vbYesNo + vbModalApplication)
It disables the [x] button of the messagebox.
|
|
|
|
|
Hi
i want convert a network Path to Loacal Path,
Eg. \\Client1\DBBackup
D:\DBBackup
result should be like this
D: is the Drive of Net work Folder 'DBBackup'
can you give any suggestions Or solutions
By
George Garvasis
|
|
|
|
|
Hi
You Can Use This Function To Convert NetworkPath To LocalPath
Private Function ConvertToLocalPath(ByVal NetworkPath As String)
Dim LocalPath As String = "D:"
Return LocalPath + NetworkPath.Substring(NetworkPath.IndexOf("\", 2), _ NetworkPath.Length - NetworkPath.IndexOf("\", 2))
End Function
|
|
|
|
|
This is easy using the Path class in the System.Io namespace:
Imports System.Io
.
.
.
Dim root As String = Path.GetPathRoot("D:\some\file.path")
This also works just as easily with a UNC path.
Or are you asking how to determine which drive letter is being mapped to a UNC path??
|
|
|
|
|
hello
i want to just enter capital letters in a cell of c1flexgrid,
but i cannot handle the event properly so that i could validate this check before the cell lost focus.any code ? help?
i am using dotnet 1.1
thanks in advance
hello
|
|
|
|
|
Hi
Past this code to KeyPress Event Of Your FlexGrid
e.KeyChar = Char.ToUpper(e.KeyChar)
|
|
|
|
|
but it just changes the vbery first typed character
rest of the characters remain nchanged
thanks
hello
|
|
|
|
|
hi guys
i want to print windows based report on dot matrix printer. is it possible?
if yes what will be the h/w , s/w requirement for it ? and coding structure for it in vb.net. since i have developed report in vb.net2005 & crystal report.
Thanks
bye
|
|
|
|
|
As long as the printer has a windows printer driver and you communicate with it using that driver only (no escape code injection etc) then the hardware layer should be of no consequence - it should just work...
|
|
|
|
|
thanks for reply. then what should i do for printing on dot matrix ? pliz. suggest me code.
Thanks
bye
|
|
|
|
|
He just told you! It's no different that if you were printing to a laser printer.
Crystal Reports will handle generating the image of the page and pass that to the printer driver which will convert that into the native language of the printer. There's nothing your code has to do any different.
|
|
|
|