|
You're really going to need to learn a little about object-oriented programming, otherwise you're not going to understand how this works, and you'll be back here tomorrow with a similar problem.
Where's the code that actually displays the Settings form?
|
|
|
|
|
Try changing the name of the form from "Settings" to something else. "Settings" is a common name used for various classes, some of them exposed as static, that could be screwing with your code.
Also, do not use text data directly from textboxs without validating it first.
When the breakpoint is hit, the yellow line shows you which statement is going to be executed next. If you hover the mouse over a variable name, it'll show you what the current value of that variable is.
|
|
|
|
|
Ok so I changed it from Settings to Prefs. Still no luck.
I'm starting to get discouraged because like you said when I hover the mouse over I see the variables. SMTPServer.Credentials shows nothing, SMTPServer.Host shows nothing as well. When I hover over the Email.To.Add it doesn't show anything at all, doesn't even outline the variable like the other ones do.
Also, when I go in and just change all the variables to the actual values I'm able to get past the lines. All the way down to SMTPServer.Send(Email) but it says "failure to send."
Is there a better or easier way to write this code?
As for validating the text boxes do you just mean running an if statement to make sure there is an actual value in them?
Thanks,
|
|
|
|
|
If everything says their are empty, I'm will to bet that you instantiated a second copy of your Settings (Prefs) form and are using the empty values from that, nor the one the user sees.
|
|
|
|
|
I haven't read the entire thread, but yet I am going to offer a wild guess:
did you instantiate your Settings Form more than once?
i.e. do you have more than one new Settings in all of your code?
if so, you are seeing and interacting with one, but your code is reading empty boxes from the other!
|
|
|
|
|
Luc,
Thanks for the reply.
I'm actually not using more than one New Settings in my code. This part of my code is the only part trying to read these boxes.
I'm wondering if I completely got rid of this code if there is a different way of going about it.
Thanks,
|
|
|
|
|
OK, then work your way through the problem, one step at a time.
step 1 would be making sure this works:
Private Sub SendEmail(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Console.WriteLine("txtTo.Text=" & Settings.txtTo.Text)
End Sub
then add similar statements until you hit the problem.
|
|
|
|
|
Ok so this is where the problem seems to be.
When it shows "txtTo.Text=" it shows nothing.
I double checked and confirmed that there is data in these text boxes.
Now I guess I have to figure out how to make point to the text boxes.
|
|
|
|
|
yep. It proves your problem is not related to e-mail, there is an overall problem of your objects not being what you think they are, such as the possibility of having more than one Form instance I mentioned earlier. I can't really help you any further as I have seen only a fraction of your code.
BTW: a similar situation would arise when you would accidentally have two textboxes at the same location, the top one being the one you see and edit, the bottom one being the one your code is referring to.
|
|
|
|
|
Yes you are correct.
I just tested the idea of having a different form with a text box name "ToBox". The form is called "XForm".
When I change the code from ("txtTo.Text=" & Settings.txtTo.Text) to ("txtTo.text=" & XForm.ToBox.Text) it shows the text.
Clearly there is some reason my text boxes aren't linking correctly.
Thanks for showing me how to test this idea.
Now I just have figure out what the deal is with the textboxes.
|
|
|
|
|
Also, when I change it to a different textbox in that same Settings form, it works.
Something fishy going on here.
Thanks for you help, I think I just need to start over with all of the textboxes.
|
|
|
|
|
a few more things:
1.
did you do or encounter anything strange while setting up your project? your form?
2.
assuming you use Visual Studio, did you edit one of the designer files? or move them around using Explorer?
FYI: what you design graphically gets translated in a code file, say Form1.designer.vb, which may or may not be hidden in your solution pane, depending on settings, or some buttons.
[ADDED] You are not supposed to edit those generated files! [/ADDED]
|
|
|
|
|
probably check the properties window and see what name is given to the text box there.....it might be that the names are not matching with each other....
|
|
|
|
|
I have the following subroutine to load a listbox of database tables:
Private Sub DisplayDatabaseTbls(ByVal tblTables As DataTable)
lstTbls.Items.Clear()
For Each row As DataRow In tblTables.Rows
lstTbls.Sorted = True
lstTbls.DataSource = tblTables
lstTbls.ValueMember = "Table_Name"
lstTbls.DisplayMember = "Table_Name"
Next
End Sub
This works just fine until I deside to select a differnt database, then I get the error:
Items collection cannot be modifed when the datasource property is set.
I understand it will not let me repopulate the listbox while it is bound to a datasource.
What I want to know is how I can disconnect the datasource, and clear the listbox. In VB6 all you had to do was Listbox1.Clear.
Thanks is advance
Quecumber256
|
|
|
|
|
Have you tried lstTbls.DataSource = Nothing ?
To me that looks to be the opposite of lstTbls.DataSource = someDataSource
|
|
|
|
|
Luc,
That did it. All I did was place lstTbls.DataSource = Nothing at the top of the subroutine. So whenever I changed databases it will disconnect the datasource, then clear the list box, and reconnect the datasource and repopulate the listbox.
Thanks this helped a bunch.
Quecumber256
|
|
|
|
|
What is software self check?
How can wirte software self check in VB.net?
plz....thz....
|
|
|
|
|
phowarso wrote: What is software self check?
A general checkup on the validity of the software, I guess.
phowarso wrote: How can wirte software self check in VB.net?
Depends on what you need. Sometimes it's enough to simply compute a hash from the files that you have, other times you'd might want to check the availability of the database and the validity of the backupfiles.
What part of your software has healthconcerns?
I are Troll
|
|
|
|
|
how can read the sector (eg: sector number 150 to 200) on a CD directly in VB.net?
please help me...thz....
|
|
|
|
|
Read up on CreateFile[^]. I think the section you're interested in is about half way down, under "Physical Disks and Volumes". There is no ".NET way" to do this. You have to P/Invoke the Win32 functions directly to accomplish this.
There an article here [^]on CP about it, but it's not written very well.
and a quick Google for "read disk sectors vb.net" comes up with these[^].
|
|
|
|
|
|
If you know the coordinance of the top-left and the bottom-right, then it's down to basic maths to calculate the coordinance that the mouse is pointing to.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
One thing to be aware of is that a map is a projection of a three dimensional curved surface onto a two dimensional plane, and there are different ways of handling that projection. So in order to convert the mouse position to a latitude/longitude on the map you need to know the projection in use for this particular map.
In this case, it's not really a map, it's a satellite photograph. I have no idea how the maths works for mapping a 2D digital photograph back to the corresponding real-world position on the surface of a sphere. In fact the world is an oblate spheroid, I think, not a perfect sphere but you could probably make things easy by assuming a sphere and still be close enough for most practical purposes unless you're planning to write your own cruise missile guidance system.
|
|
|
|
|
David Skelly wrote: unless you're planning to write your own cruise missile guidance system.
Well actually.....
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi All,
I want to develop an application in which it will show list of IP address of all working System in LAN and when i select any IP address from list and want to show message box on selected IP address's System then it will show message box.
I am able to get all IP Address of all working system. but not able to send message on selected IP address's System.
So my question is that, how i send message at selected IP Address system?
I don't know much about Network and Socket Programming.
Please guide me what i need to do for this task and what is the best way to achieve them.
If you all have any reference book then please revert me back name of the book.
Regards
Dharmchand Dhingra
|
|
|
|