|
TimKiwi wrote:
When I try to call mySubroutine from the Clickhandler I get "Name 'mySubroutine' is not declared"
Uhhh....You have to replace the mySubroutine with whatever routine you want to run! In the code I posted, "mySubroutine" wasn't defined anywhere, so of course that error came up. You can't just copy and paste my code into yours and expect it to work. It was only an example to demonstrate a concept. You have to put YOUR code in the place of "mySubroutine".
TimKiwi wrote:
I know I am missing something really basic here, I cant seem to call any subs in the Form1.vb code from the ButtonArray.vb code...........what am I doing wrong ?
I can call the subs in ButtonArray.vb by using MyControlArray.Sub()
Why cant I call back the other way ?
This is because the ButtonArray clas know nothing of the Form1 class your trying to call back into. In a proper desgin, the ButtonArray class shouldn't have to call back into Form1 and makes changes to it. Form1 should make all the changes to Form1. The reason why it works one way and not the other is because your Form1 code instantiated a ButtonArray object and not the other way around. If you have ButtonArray instantiate Form1, you'll end up with TWO Form1's and the calls ButtonArray makes will not go to the original Form1.
From the questions you've posted, it looks like your just starting in VB.NET. I would HIGHLY recommend picking up a book on Beginning Visual Basic .NET and start from there. There are alot of concepts that you need to pick up to understand whats going on and the Forums are no the place to do that...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
i use the belowe code:
Dim emailMessage As MailMessage
emailMessage = New MailMessage
emailMessage.From = "m_nahid2001@yahoo.com"
emailMessage.To = "sondos_bahadori@yahoo.com"
emailMessage.Subject = "mail"
emailMessage.Body = "sallam"
SmtpMail.SmtpServer = "smtpmailserver.myISP.com"
SmtpMail.Send(emailMessage)
but it cause this error:
Could not access 'CDO.Message' object.
|
|
|
|
|
Make sure you machine has either Outlook (Microsoft Office) installed or has Internet Information Server installed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi!
my program dosen't know the system.web.mail
please help me .
thanks alot.
|
|
|
|
|
hi!
my program dosen't know the system.web.mail
please help me .
thanls alot.
|
|
|
|
|
Have you added System.Web to your references list? If not, follow these instructions:
1. For the Visual Basic project you are working on, right-click on the "References" folder and click "Add Reference...".
2. Scroll down the list of components on the ".NET" tab and double-click the "System.Web.dll" component, choosing to add it to your references.
3. Click OK.
4. Also add Imports System.Web.Mail to the top of the vb source file.
Now compile your project. It should work then. Best of luck on your future programming efforts!
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I am the owner of a website that sells software that runs games on pogo.com automatically. The website is called WWW.BADGEHELP.COM
I have 25 titles available so far. The software reads the screen and then determines what to do in the game next (i.e. a slot machine is on the screen, if the bet max button is available, click it, if not, do nothing)
I need the following "helpers" to be made for pogo.com games:
1. Perfect Pair Solitaire
2. Dominoes
3. Jungle Gin
4. Texas Hold'em Poker
They .exe's need to run with IE and AOL browsers. The .exe also needs to be shareware, run for about 8 hours and then prompt the user to register at WWW.BADGEHELP.COM and generate a unique code for the user. I will also need a keygen that will "unlock" the shareware.
|
|
|
|
|
Try here[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
I’m trying to transfer a value from one form to a global variable on another form.
Here is what I have:
Form1
TxtBox1
Form2
Dim dataFromForm1 as a string
How can I set dataFromForm1 = form1.txtBox1.text in form2?
I know that if I was going to transfer the value to a control it would look like this:
Form2.txtBox2.text = txtbox1.text
But how do I assign a value to a global variable on the form to be opened? The global variable dataFromForm1 will need to be available for Form2_Load .
Thanks
Brad
|
|
|
|
|
First, there are no such things as "global" variables in the .NET Framework.
Second, you almost had it. In your Form 2 class code:
Public Class Form2
Public dataFromForm1 As String
.
.
.
End Class
A better implementation would be to expose this as Property on Form2 so you have the option of doing some validation on the data before actually setting the value:
Public Class Form2
Private m_dataFromForm1 As String
.
.
.
Public Property dataFromForm1() As String
Get
Return m_dataFromForm1
End Get
Set(ByVal Value As String)
' Do some kind of validation of the data.
' If the validation tests pass,
m_dataFromForm1 = Value
End Set
End Property
End Class
An excellent article on your very subject is on MSDN here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Anyone has seen sample program before?
|
|
|
|
|
I would like to be able to browse a directory structure, open a folder, send the path to a text box and then close the dialogue box.
Does anybody know if this can be done?
Thanks
Brad
|
|
|
|
|
|
Ok, so im writing a routine to save a coordinate set to a file, and its not working, and i dont get any error messages, so i dont know why. Could anyone please tell me what im doing wrong?
-
Sub InstPT(ByVal r As Double, ByVal theta As Double)
Dim XDomain As String, YDomain As String
Dim x As Double
Dim y As Double
x = r * System.Math.Cos(theta)
y = r * System.Math.Sin(theta)
txtXCart.Text = x
txtYCart.Text = y
Dim Filename As String
Filename = "workfile.pnt"
'Dim FS As FileStream
'Try
'FS = New FileStream(Filename, FileMode.Append, FileAccess.Write)
'Catch ex As Exception
'End Try
If x >= 0 Then
XDomain = "+"
Else
XDomain = "-"
End If
If y >= 0 Then
YDomain = "+"
Else
YDomain = "-"
End If
If File.Exists(Filename) = False Then
Dim SR As StreamWriter = File.CreateText(Filename)
SR.Write("X" & XDomain & x.ToString & "Y" & YDomain & y.ToString)
SR.Close()
Else
Console.WriteLine("File exists, appending")
Dim SR As StreamWriter = File.AppendText(Filename)
SR.WriteLine("X" & XDomain & x.ToString & "Y" & YDomain & y.ToString)
SR.Close()
End If
'FS.Close()
If x > PlottingBounds.Right Or x < PlottingBounds.Left Or y > PlottingBounds.Top Or y < PlottingBounds.Bottom Then
OpenAndPlot(Filename)
Else
pton(x, y, Color.Black, PlottingBounds, 0, 0)
End If
End Sub
-
all variables are declared, and all functions exist. Thanks!
Marc Micalizzi
|
|
|
|
|
Probably, you're looking in the wrong place for the resulting file. Since you have not specified a file path, the actual location is dependant on how the code is run.
|
|
|
|
|
Shouldnt that not be a problem since i am writing to, or creating the file (if it is non-existant)? I'm running this on a PocketPC, and i searched it's entire memory for workfile.pnt, and still no results, so the problem is that it is not creating, nor writing to, the file for some reason.
|
|
|
|
|
You'r going to have to step through your code line-by-line and watch it's execution to determine where the problem is. If the code creates the file with an Open statement, don't run the next line, just go and find the file. Verify that the code is doing, and going, exactly what and where you think it should.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, Thanks. I got it working now. I found the error, it was in another routine and it was trying to convert too much of the string to an integer. (in otherwords it included 1 too many characters being either an "X" or a "Y" lol)
|
|
|
|
|
Hi,
Does anyone know how to wake a PC that has gone into suspend mode? I know there are things like Wake-on-LAN, but I am trying to wake a PC at a specific time that has gone into suspend mode and that is not on a network at all. I assume there is some way to tap into the advanced power config interface. I have managed to get an application that fires up at a specific time, but I need to get the timer to keep going even if the PC goes into standby, because at the moment the application I wrote does not start once my PC goes into standby.
Any pointers and tips will be greatly apreciated
Thanks
|
|
|
|
|
I have no examples on how to do this, but, in theory, you register your app with the power manager with a description of the minimum power configuration your app will tolerate. Being an app that is constantly running, I don't think your app will tolerate the machine going to sleep at all. The power manager has no wake-on-schedule support.
But, the description of the Power API's begins here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is what I am trying to accomplish:
Specify a number "123"
Look for that number in the database.
If found, read everything in that row.
If not found, append the info into the database.
I am getting close to being able to read the database but have no clue how to write to it.
Is there anyone out there that may have a simple example of how to read and write to an access database?
Thanks in advance.
Beginner in VB.NET
|
|
|
|
|
Well, let's see what you've got so far and we'll see what we can do about adapting what you have for writing and pointing you in the right direction.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.Click
Dim DS As New DataSet()
Dim Command As String = "SELECT * FROM Database WHERE Number1 = '" & cboNumber1.Text & "' AND Number2 = '" & cboNumber2.Text & "' AND Number3 = '" & cboNumber3.Text & "'"
Dim Adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(Command, Connection)
Dim CMDBuilder As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(Adapter)
Dim I As Integer
On Error Resume Next
If cboNumber4.Text = "" Then
Connection.Open()
Adapter.Fill(DS)
For I = 0 To DS.Tables(0).Rows.Count - 1
cboNumber4.Text = DS.Tables(0).Rows(I).Item(3)
cboNumber5.Text = DS.Tables(0).Rows(I).Item(4)
cboNumber6.Text = DS.Tables(0).Rows(I).Item(5)
Next
Else
Adapter.UpdateCommand = CMDBuilder.GetUpdateCommand()
Adapter.Update(DS.Tables(0))
End If
End Sub If the first three numbers are there then the other two are put onto the screen using comboboxes.
Here is my problem:
If cboNumber4.Text = "" then
search the database and if found write to cboNumber4.text and cboNumber5.text
If it isn't found then I need to choose the fourth and fifth number and then add all five numbers to the database.
Maybe I should do this procedure in another button, since I have to manually choose the fourth and fifth number and then add them all to the database.
Any suggestions? Thanks.
Beginner in VB.NET
|
|
|
|
|
Britnt7 wrote:
Here is my problem:
If cboNumber4.Text = "" then
search the database and if found write to cboNumber4.text and cboNumber5.text
If it isn't found then I need to choose the fourth and fifth number and then add all five numbers to the database.
Maybe I should do this procedure in another button, since I have to manually choose the fourth and fifth number and then add them all to the database.
Any suggestions? Thanks.
Huh? Let's see if I get this straight. You have 5 ComboBox's on a form. The use then picks numbers from each of these CB's, ComboBox1, ComboBox2, and ComboBox3. When all 3 of these ComboBox's have a value, the user clicks a button. ComboBox4 is then checked to see if it has a selected value. If it does not have one, the database is queried to see if it has the numbers selected in ComboBox's 1, 2 and 3.
If the numbers do NOT exist in the database, then ComboBox's 4 and 5 are enabled and the user gets to pick numbers from those two ComboBox's. Then the user clicks another button to write the values of all 5 ComboBox's to the database.
Else if the numbers DO exist in the database, then ComboBox's 4 and 5 are populated with the database values.
Correct?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|