|
My problem seems to be an issue of generating random numbers. While the statements are quite clear and easy and all of us are familiar with it, I never can seem to come up with a set of truly random numbers, while hating to sound totally stupid and an idiot, it has been quite frustrating. I have used the "Randomize" statement, but it seems to not work very well or I have overlooked something that is far too easy. The program I am creating relies on a set of truly randome numbers to function.
I use Visual Basic.net and I also Have Visual C++.Net as well, maybe I should switch gears and use another programming language??
Michael Goesch
|
|
|
|
|
Computers cannot pick truly random numbers.
They can't make guesses...
They don't feel pain, or remorse...
Oh, sorry... getting carried away there.
http://home1.gte.net/deleyd/random/introduction.html[^]
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
i had a similar problem with vb.net first i had coded the game yahtzee in vb6 and it worked fine then i was converting it into vb.net and after i got all the stuff out of the way i ran it in debug mode and i saw i got 5 random numbers which i use to change the pictures of the die showing but when i took it out of debug mode i get the same five numbers like i get all 1's or all 2's etc but the moment i put it into step by step debug it works perfectly again so maybe its a bug in .net cause i got pretty pissed off because i thought how in the hell do i debug something that works perfect in debug mode? don't know if this helps or not
|
|
|
|
|
Hi,
I want to copy a Table (in sql server) to a specified Text File programmatically using DTS.Can any one help me?If possible can u please paste the code?
Thanks in advance
|
|
|
|
|
You can do this one of three ways.
1.) The best way is to use an ADO Recordset / ADO.NET DataSet and use the "Save" / "WriteXML" Methods. This is best because both the Recordset and DataSet can open an XML file.
2.) Use BCP to Bulk Export data from the Table to a Text File. This is essentially what the DTS does.
3.) There is also a way to Bulk export using an XML format but I can't remember the command.
Not all those who are lost are looking to be found. But of those who are lost and those who are found, all are looking for something higher than themselves.
|
|
|
|
|
Hi,
I build a .NET COM class that has a method (Print) with some parameters:
.NET Code:
Class Print
Public Function DoPrint( _
ByVal PDFPath As String, _
ByVal PDFName As String, _
ByVal Printer As String, _
ByVal sSQLCol() As String)
VB6 Code:
dim cPrint as New Print.DoPrint
Dim stringSQL1, stringSQL2 as String
Dim SQLArray() As String
stringSQL1= "SELECET * FROM TABLE1"
stringSQL2 = "SELECT * FROM TABLE2"
SQLArray(0) = stringSQL1
SQLArray(1) = stringSQL2
cPrint.Print(pdfpath, pdfname, printer, SQLArray)
When I try to compile the VB6 app it gives me the following error:
"Function or interface marked as restricted, or function uses an Automation type not supported in Visual Basic"
How can I do this?
Many thanks in advanced.
Pedro
|
|
|
|
|
ordepavlis wrote:
Class Print
Public Function DoPrint
....
dim cPrint as New Print.DoPrint
I didn't know you could initialize a variable to a method ( DoPrint is a method). Perhaps that's where the error is??
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Hi,
Sorry, You are rigth!! I copied the code badly.
So here it is the correct code:
.NET:
dll Name -> Print
Class Name -> CReport
Method -> DoPrint
VB6:
dim cPrint as New Print.CReport
Thanks
Pedro
|
|
|
|
|
ordepavlis wrote:
Dim stringSQL1, stringSQL2 as String
Perhaps it's this part. When do this in vb6, stringSQL1 is dimensioned as a variant datatype. So you're actually passing variant when you're supposed to be passing string.
You should declare it like this
Dim stringSQL1 as string, stringSQL2 as string
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Hi,
It gives me the same error.
Pedro
|
|
|
|
|
As control array is no more supported in VB.NET ,but i have more than 100 textboxes in my form ,I want to access those with help of index in a loop ,as shown below
for i=0 to n
txtName(i).text=i.tostring
next
How it is possible please help me with source code.
|
|
|
|
|
Hi,
Why so many textboxes??? Isn't it a bit hard to with for the end user???
If you open your controlbox window you can find a wrapper for control array's
Go to your customize Toolbox window.
Then select the tab ".NET Framework Components"
Find the component "TextBoxArray"
that's the compatibility component for the control array.
but why not redesign your application to use less textboxes or assign the same eventhandler to one event and check on the "sender" variable.
greets,
Poolbeer
Speak Out! Use the Source, Luke!
(Dr. GUI .NET #5)
|
|
|
|
|
Hi all,
I developed an application in Windows 2000, menu of application i used unicode font and then it run well, but when i bring it to Windows 98 so menu dose'nt appear in unicode font, i dont know why can you help me!!!
Thanks,
cuongnt
|
|
|
|
|
This doesn't work. I thought declaring a variable as public in a class made it global.
Public Class Form1
...
Public i as integer
Private Sub Form1_Load(...
i = 1
End Sub
End Class
Public Class Form2
...
Private Sub Form2_Load(...
Dim j As Integer
j = i compiler says i is undefined
End Sub
End Class
|
|
|
|
|
well, i and j are in different classes so they cannot see each other.
now, if your instance of Form1 is global, then you can access i through it like this.
Global instance of Form1:
Public MyForm1 as Form1
Access instance of Form1 in class Form2:
Public Class Form2<br />
...<br />
Private Sub Form2_Load(...<br />
Dim j As Integer<br />
j = MyForm1.i<br />
End Sub<br />
End Class
Daniel E. Blanchard
|
|
|
|
|
Yeah, but the VB doc says
"The Public keyword in the Dim statement declares elements to be accessible from anywhere within the same project, from other projects that reference the project, and from an assembly built from the project."
|
|
|
|
|
David Williams wrote:
The Public keyword in the Dim statement declares elements to be accessible from anywhere within the same project
That's true if the element is global, but you forgot about how scope works. An element declared within a class is not global, but if declared as public can be accessed outside of the class. In order to do that you must reference the class.
For example:
You have a global variable declared in your project:
Public Var1 As Integer 'Global, accessable anywhere in the program
Then you have a class that can use that variable:
Public Class TestClass1<br />
<br />
Public Var2 As Integer 'Accessable from outside the class<br />
Private Var3 As Integer 'Accessable only in the class<br />
<br />
Public Sub MyProc()<br />
Dim Var4 As Integer 'Accessable only in this method<br />
Var4 = Var3 'This is OK because Var3 can be accessed anywhere in the class<br />
End Sub<br />
<br />
Private Sub MyProc2() <br />
Dim Var5 As Integer 'Accessable only in this method<br />
Var5 = Var1 'This is OK because Var1 can be accessed from anywhere.<br />
End Sub<br />
<br />
End Class
If you have a global instance of that class:
Public TestClassObj as TestClass1
Then you can access public data inside that class:
Public Class TestClass2<br />
<br />
Private Var6 As Integer<br />
<br />
Public Sub DoSomething()<br />
Var6 = TestClass1Obj.Var2 'This is OK because TestClass2 has indentified where Var2 can be found<br />
End Sub<br />
<br />
End Class
So, the VB doc you mentioned was correct, but you have be carefull where you declare your elements and always mind program scope.
Daniel E. Blanchard
|
|
|
|
|
Can I create dll using VB as in VC++?
|
|
|
|
|
VB6 can not create DLLs that export functions like C++ can. It can only create COM DLLs.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
I have an app which has an intensive process kicked off from a button. During the process the Screen.Mousepointer property is set to vbHourglass and then at the end back to vbNormal. This works fine. However, if I have un-saved changes then a dialog is displayed prior to kicking off the intensive process and prompts the user to save or not etc, when the dialog closes the process kicks off BUT the Mousepointer property although being set to vbHourglass after the dialog has been closed doesn't change the Mousepointer visualy from vbNormal. I have DoEvents after the Screen.Mousepointer = vbHourglass.
Can anyone PLEASE let me know what is going wrong and how I can overcome this problem, it is driving me mad!
|
|
|
|
|
In VB 6, as I recall, you could print an entire project with one Studio command, set the header, etc. Now, do I have to print each file and class seperately? Can't I customize the header, at least?
|
|
|
|
|
Is there a way of creating Activex controls (similar to the windows user control in VB 6.0) in VB.Net. I want to use such a control in Web forms or HTML page.
Currently I am able to use an Activex control (windows user control) created with VB 6.0 in ASP.Net web form. Similarly I created a Windows user control in VB.Net and when I added the control in ASP.Net application's tool box using 'customize tool box' option the control shows up, but is greyed out.
|
|
|
|
|
Is there any way of using a dll file in VB if there is no documentation for the dll file.
Please help
Sudar
|
|
|
|
|
Hello everyone,
I am a newbie and I am hoping that you all can help me with a little trouble I am having. I have a VB.NET CRM application that I am writing for my company. I am using a MySQL database to hold all of the data. The app is a windows form application which will be installed on everyone's computer in the office. I need to be able to authenticate the user from a list of users in a db table (which I can do no problem) but I am getting stuck on how I can keep the user's logged in status so that I can record (in another database table) the actions they perform in the system.
I appreciate any and all help and advice that you can give me on how to do this. Have a great day.
Sincerely,
Robert W. Dempsey
|
|
|
|
|
hey i dont know if your still having the problem with keeping track of a user's logged in status but a simple way would be to create a loggedin field on the end of the user's record and when they login set that field equal to 1 and when they log out set it to 0
|
|
|
|