|
xmen_xwk wrote: Dim a As New Form1
a.TextBox1.Text = "111"
I'm at a loss as to why so many people do this. a is a NEW instance of Form1. It has nothing whatsoever to do with the instance of Form1 that already exists and is visible. a has the text 111, and the other instance keeps whatever text it had.
You need to set up a delegate between Form1 and Form2, so that Form2 can call a method in Form1 and pass through the value.
Also, you need to keep your controls private or protected. I guess you've come from VB6 ? VB.NET is an object oriented language, one of the things you should aim to achive in an OO language is to hide as many details of your class to clients as possible.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
man i m new in vb.net so please tell the codes
i dont know what is delegate ??
yeah you guessed right, i used vb 6 it was so easy
|
|
|
|
|
The problem is it's too easy on vb6.
Another way to do it is form2 return some values and a flag to indicate whether the values from forms 2 is valid, to whichever form that call form2.
Form2
Has public property of ReturnValue, which set some value depending on user action (drop down selected index changed, text box etc)
Has boolean flag IsValid to indicate the ReturnValue is valid (in case user didn't select anything, yada, yada)
On Form2 OK button, set DialogResult to DialogResult.OK
Validate return value, if validate OK, set IsValid to true else false.
Close Form2.
On Form1 button event
new Form2 and Show(), and save Form2 DialogResult
check Form2 DialogResult, if it is DialogResult.OK, check IsValid, if IsValid is true, take value from ReturnValue and put in Form1.TextBox.Text.
Passing Values Between Forms
|
|
|
|
|
hi i did it , to do code
1st i made a module and coded it:
Module Module1
Public t As Integer
End Module
then i wrote code in form2`s button:
t = 22
Me.Hide()
and then i wrote code in form1`s activated:
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
TextBox1.Text = t
End Sub
now its working
|
|
|
|
|
OK - you're still using VB6 ? This will work, but, as I said, it's really a bad way to go about things. If you're doing hobby stuff, it probably doesn't matter, but I'd be speaking to anyone on my team who wrote code like this.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
VB6 *was* easy, in the process, it encouraged really bad habits.
My core recommendation - even if you're just coding for fun, anyone who wants to program, should be able to use google. This site is great, but it's also great to be able to actually find stuff out for yourself.
http://www.google.com.au/search?hl=en&q=vb.net+delegate&meta=[^]
There's plenty of info on the web about delegates. I deliberatly try to answer and give people the keyword that will give them all the info they need, if they can be bothered to look.
If you're going to use VB.NET, you should really forget the VB syntax, just like learning C#, I had to ignore the C++ syntax. It's a new language, and you need to learn it, not try to turn it into the one you used before.
By all means, keep posting questions here. But, do try to do some research first, you'll find things move a lot quicker for you.
Good luck !!
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks for doing that for me
now i understand the mean of delegate but i still not understand how to use , i m tring to know about it
it will more easy to undertand if someone help me through example than read in webs
|
|
|
|
|
I don't understand - if I write up an example, it will just be another example on the web.
I suggest reading the articles, trying to follow them ( it's really pretty easy ) and asking specific questions if you get stuck. That way, you give yourself a chance to learn, and we're still here to help if you really can't manage on your own.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
man im really confused because i have two big problems and i dont know which should be solved first. if you give me codes so i will learn \ understand my self to see them
i need just codes
please
thanks
|
|
|
|
|
Seriously - any code I give you will be no better than the code in an article. If you can't understand an article, then you won't understand the code from me. So, just try.
You realistically have three options
1 - stop coding
2 - pay some one to do it for you
3 - learn how to do it.
I don't have enough info to give you code any better than what's on 100 articles, but even if I did, that would not be helping you. What you want to do is very straightforward. Read an article, think about it, and try to write your own code that follows the (straightforward) example. Then, if you get stuck, at least you tried to write some code, and that alone will help you learn, even if you need to ask here again, posting your code and explaining what you've tried.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
man i read alot of articles but they dont have code that will help me
i can understand all code if you try to give or give any address for article
i search on google but nothing found
|
|
|
|
|
|
searching words
1.text change through form2 vb.net
2.form1`s text change
3.text changing
4. how to change textbox text from form2
5...... more
and man the address you give me i read all and i cant understand because it too advance and based on database,and im new in vb.net
thanks im still trying to get this
|
|
|
|
|
thanks man now the time is come to end this topic too , now i get the articles which can help me but they open only in vs 2005 , so now im thinking to buy it.however i read the codes of articles but it will more easy when it open as program
|
|
|
|
|
You needed to search for delegates - that's what I told you to use, so that's what you needed to search for.
xmen_xwk wrote: i cant understand because it too advance and based on database,and im new in vb.net
I reiterate - buy a book, a simple book, and work through it. Forget this project for now. If you can't understand those articles, then it's beyond you at this stage, so work up to it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi there
I`m a newbie to the programming in visual basic.
I have made myself a website in visual basic, and precompiling, and the ctrl+f5 utility is all working, and I`m pretty happy with the site.
But now let`s approach the problem:
I have tried to publish the site to my server, but al I get is a list of folders and files. The same happens when I upload via ftp.
I have a sql file attached to the website, but I dunno which program to use.
I`ve tried to use phpmyadmin, but with no luck.
Can anyone help a newbie please?
PS I use Visual Studio 2005
-- modified at 11:43 Saturday 30th September, 2006
-=Why Me?=-
|
|
|
|
|
Is ASP.NET running on the site ? If not, the server won't know what to do with an aspx file, you'll get a directory list or a message to say you don't have permission for directory browsing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well I don`t think that ASP.NET is running by default, But is there a way I can install it?
BTW thanks for the reply
-=Why Me?=-
|
|
|
|
|
If IIS is installed on a machine and you install the .NET framework ( make sure it's the same one your site uses, probably 2.0 ), it will install ASP.NET.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hehe.. I just found out that the webserver doesn`t support asp.net, so I changed my web provider.
This should be up and running in a few days.
Then I will probably drop in and bother all you nice people here with more newbie questions
-=Why Me?=-
|
|
|
|
|
I want open a file with my program as default when i click on that file
i need Delphi or VB code for this task when i execute my program setup and install my program a file for example when i click on *.Nouri this file open with my application i want a source code that if i install my program this task done no i go to My Computer->tools->Folder Option->File Types. Thanks.
|
|
|
|
|
How does this differ from the question that you asked six minutes earlier?
---
b { font-weight: normal; }
|
|
|
|
|
if you go folderoption in my computer and go to file type you can change
file extension; but i want change it in application that i write in Delphi or VB no in my computer->Folder Option -> File Type
|
|
|
|
|
You might want to open RegEdit and look under HKEY_CLASSES_ROOT. You'll have to modify the registry just as you see here. For example, if you wanted to modify the entry for the .TXT extension, you'll have to find the txtfile key under HKEY_CLASSE_ROOT. Take note of how the registry keys and values are laid out. What you put under here will change depending on what you want to modify. You'll have to look at a bunch of different keys for various file extensions to get an idea of what you have to change and how.
WARNING! Make a backup of your HKEY_CLASSES_ROOT key BEFORE you make any modifications. If you don't know what you're doing and why, you will screw something up and you're only recourse is to restore from the backup!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hellow to all ..
i am trying to build in crystal report , Matrix report , anyone have idea how to to this ?
if so please send me a link , or tell me , thxx
|
|
|
|