|
Dave thanks for your guidance on figuring this out. Basically, I dimmed the frmlogin in my frmmain and use the login credentials to determine whether or not to "Me.btnMaintainEmployees.Enabled = False". This works great. Thanks again.
|
|
|
|
|
Hello Everyone,
I am trying to code a program in VB6 where i have a DLL. My aim is to call some functions from the dll. I am totally new to this VB envoirnment and hence require some help. Actually this is a part of PHP project which is to be interfaced with some other application through this dll. The dll guys gave this code and i simply copy pasted this code in VB application. The minute i compile the code i get an error "Constants, fixed length strings, arrays, user-defined types and declare statements not allowed as public members of object modules."
This is the part of the code, i am getting error on the very first line of the code.
Option Explicit
Declare Function RTSOpen Lib "RTSLINK.DLL" Alias "Open" () As Long
Declare Function Send Lib "RTSLINK.DLL" (ByVal strRequestXML As String) As Long
Declare Function GetLastErrorMessage Lib "RTSLINK.DLL" () As String
Public Sub vbSend()
Dim nResult As Integer
Dim strErrorMsg As String * 255
Dim strRequestXML
Dim strResponseText
....
Regards,
Chaitannya
|
|
|
|
|
What kind of project did you create?? What file is this code being pasted into??
Mind you, it's been about 7 years since I last used VB6, so my memory may fail me at any point...
|
|
|
|
|
A simple exe project, copy pasted the code in the Form page.
|
|
|
|
|
Hmmm... It would appear that somewhere along the line there is code outside of a function/sub that can only work inside a function/sub. This is anything that isn't a declaration.
It's also possible that some of the code you were given will only work if pasted into a Module, not a form.
|
|
|
|
|
Hi
I am developing windows based application ...
write this code to fill the datagridview.....
i am getting error at fill that
<br />
<br />
If con.State = ConnectionState.Open Then con.Close()<br />
con.Open()<br />
Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con)<br />
sqlcommand1.CommandType = CommandType.StoredProcedure<br />
sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber<br />
sqlcommand1.ExecuteNonQuery()<br />
Dim GDataAdapter As New SqlClient.SqlDataAdapter<br />
GDataAdapter.Fill(GDataSet, "Outbound_Data")<br />
DataGridView1.DataSource = GDataSet<br />
<br />
|
|
|
|
|
Hi,
As u have not set any sql command for GDataAdapter u r getting that error.....
Regards,
Sandeep Kumar.V
|
|
|
|
|
Hi,
Thanks for your kind reply.
code is executed without any error but data is not displayed...
i am working on window based application previously i work on web application so on simple thing i find difficult.
<br />
If con.State = ConnectionState.Open Then con.Close()<br />
con.Open()<br />
Dim sqlcommand1 As New SqlClient.SqlCommand("usp_FillVS", con)<br />
sqlcommand1.CommandType = CommandType.StoredProcedure<br />
sqlcommand1.Parameters.Add("@ApplicationNumber", SqlDbType.BigInt).Value = ApplicationNumber<br />
sqlcommand1.ExecuteNonQuery()<br />
'dataReader = sqlcommand1.ExecuteReader<br />
Dim GDataAdapter As New SqlClient.SqlDataAdapter<br />
' OleDbDataAdapter myAdapter = new OleDbDataAdapter(myCommand); <br />
GDataAdapter = New SqlDataAdapter(sqlcommand1)<br />
GDataAdapter.Fill(GDataSet, "Outbound_Data")<br />
DataGridView1.DataSource = GDataSet<br />
|
|
|
|
|
Hi,
soniasan wrote: sqlcommand1.ExecuteNonQuery()
comment the above line and try to execute the code...
Regards,
Sandeep Kumar.V
|
|
|
|
|
Hi All,
I want to get USB PNPDeviceID from WMI or API using VB6 code. I have a code using .NET, but i need vb6 code.
Thanks & Regards
Kumaran
|
|
|
|
|
VB6 samples are getting harder and harder to come by. You can find some equivilent VBScript samples that show you how to use WMI for various things in MS's TechNet Script Repository[^].
You won't find the exact code you're looking for, but it shows you how to use WMI in VBScript code. VB6 code would be pretty close to it.
|
|
|
|
|
|
hi all,
i create a registry key in my application, to hold some information. when i see this registry key in registry editor , then there are Default value which is not set. so how can i set this default value ?
Please suggest me .
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Check the documentation on the RegistryKey.SetValue method. All you have to do to change the default value is specify the value name as either Nothing or an empty string ("").
myKey.SetValue("", "Some value")
|
|
|
|
|
Is there any limit to the maximum number of tab that can be added to TabStrip Controlin VB.
In my application after 254 tab it give memory error.
I am not able to find nay documentation specifying the maximum count.
If there is any maximum count and if can be increase in any way ?
Regards
Anil
|
|
|
|
|
I guess the real question is, why do you hate your users so much that you'd create such an awful UI. 254 tabs ?
255 is obviously #FF, it's the max value of a byte. So, it's a logical maximum value to have. And no, you can't change it without writing your own tab control.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes I appreciate what you suggest. But some application can need it sometime
In case of Excel, we should not able to add more than 255 sheet! No we can.
I got the solution for the above question.
Instead of using "Microsoft Common Dialog Control 6.0"
I will use "Microsoft Forms 2.0 object Library" TabControl
Regards
Anil
|
|
|
|
|
Tabs inside Tab, then suddenly you can put 255 x 255 tag pages! I would hate to be the user, or in general vicinity of that application....
Or you can redesign the application by dynamically load the form/area that the user want to look at.
|
|
|
|
|
darkelv wrote: Tabs inside Tab
I did not get u ?...
Any way I just told that Windows Common Control's tab control can not handle more than 255 but the other one can handle in thousands..
And of course the tabs added are dynamically. No body is going to give user interface with 255 tabs. But we can think of extreme conditions. If you are using VC interface I think it can open more than 255 files at a time in different tabs. But in practically no one would ever open...
U are using lots of application that support more than 255 tabs
If you are reading this article in Firefox now it might able to open 255 tabs,
Regards
Anil
|
|
|
|
|
I am creating a database using MS Access. I want to have the Member ID field to able to generate 5 digit Random Numbers that will not duplicate (unique)on Get Focus. I have very little experience in VB coding.
Please help to write VB.net code for accomplishing this need.
Thank you all.
Ramble
|
|
|
|
|
RambleWoods wrote: 5 digit Random Numbers that will not duplicate
that is a contradiction, it is either random or unique, can't be both: after 99999 numbers I
will be able to predict your last number, how random is that?
The one way to get uniqueness with maximum random appearance, is by creating the entire
collection of numbers, then picking one at random and removing it from the collection,
until all are gone.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
RambleWoods wrote: I have very little experience in VB coding
Then how did you inherit this task ?
The easiest way to do this ( although nasty ) is to make the column unique in your database, then keep generating numbers until one is not found in the DB. This is, of course, a disaster. The other way is to build a list of all possible numbers, then remove all numbers already in use, and pull numbers out of that list at random ( which is pretty much what Luc said ).
One other way is to create a GUID column in your database, but that's more than 5 characters. It does have the advantage of happening all in the DB. I've done licensing where we use 12 character keys and I generate them in the data layer in a proc that generates GUIDs, checks if a substring is already in the DB, and if not, spits them out.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Do you know the codes for doing random numbers in VB? If you do help me.
|
|
|
|
|
Public Sub AppendTrackNumLog(ByVal LogText As String)
Dim LogInfo As System.IO.FileInfo
Dim createDate As DateTime
LogInfo = My.Computer.FileSystem.GetFileInfo("t:\PowderedLogs\TrackNumLogPowdered.txt")
createDate = LogInfo.CreationTime
If Date.Now >= createDate.AddDays(7) Then
My.Computer.FileSystem.DeleteFile("t:\PowderedLogs\TrackNumLogPowdered.txt")
End If
Try
Dim TimeStamp As String
TimeStamp = Date.Now()
If My.Computer.FileSystem.FileExists("t:\PowderedLogs\TrackNumLogPowdered.txt") = False Then
My.Computer.FileSystem.WriteAllText("t:\PowderedLogs\TrackNumLogPowdered.txt", String.Empty, False)
My.Computer.FileSystem.WriteAllText("t:\PowderedLogs\TrackNumLogPowdered.txt", Environment.NewLine + LogText + " - " + TimeStamp, True)
Else
My.Computer.FileSystem.WriteAllText("t:\PowderedLogs\TrackNumLogPowdered.txt", Environment.NewLine + LogText + " - " + TimeStamp, True)
End If
Catch ex As Exception
MsgBox("Error: Writing to TrackNumLog")
End Try
End Sub
Now this code is supposed to simply delete and re-create a Log file. It works in the sense that it doesn't create an error. It also will delete and re-create the file but it doesn't change the Create Date. It wipes the file and puts the just the new info, but because it doesn't change the create date, every time the code runs it deletes the files, now if i step through the code and stop right after the delete line of code runs and go and physically check the folder, the file isn't there, then i continue to run the code, and when the code is done, i got back and check the file is there now, AND has a new creation date, now why would it not change the creation date unless i physically go to the folder and look for the file???? Its like the because the file is deleted and created so fast in the code that it doesn't register that its a new file.
|
|
|
|
|
This is a known problem/effect, and there is a Microsoft article about that you can probably find if you look for it. There is also a previous thread about it here on CP.
If you create a file with the same name as a previously deleted file, it will get the same creation date as the previous file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|