Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,173 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,547 people online right now. Registration is fast and FREE... Join Now!




passin values inside form

 
Reply to this topicStart new topic

passin values inside form

Wabbit
post 10 Oct, 2008 - 01:30 PM
Post #1


New D.I.C Head

*
Joined: 10 Oct, 2008
Posts: 4

I have a form and a list of articles and at side of every article I have a button "edit article" but I can't figure it out how I can send selected articleid to back end event, of course, I can do it like a link and send that information to another form but there has to be easier way to accomplish it.

I'm a newbie on c# and .NET

This post has been edited by Wabbit: 10 Oct, 2008 - 01:32 PM
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 10 Oct, 2008 - 01:49 PM
Post #2


Working Girl.

Group Icon
Joined: 6 Feb, 2008
Posts: 5,402



Thanked 94 times

Dream Kudos: 2625

Expert In: Dingleberries

My Contributions


Sounds like this was meant for the C# forum~

Since each form is an object, let's say you want to get a string from Form1 to MainForm. Create a method (in Form1) something along the lines of this:
csharp
string info = "info";
string getInfo() {
return this.info;
}


To communicate with it from MainForm, you should have something like this:
csharp
void CommunicateWithForm() {
Form1 myForm1 = new Form1();
myForm1.ShowDialog();
MessageBox.Show(myForm1.getInfo());
}

Hope this helps smile.gif

Oh, and by the way~ if this wasn't meant for the C# forum, I apologise, but since it sounds like you're asking for C# advice, I'm moving it. If I'm wrong, let me know and I'll move it back.
User is offlineProfile CardPM

Go to the top of the page

Wabbit
post 10 Oct, 2008 - 11:55 PM
Post #3


New D.I.C Head

*
Joined: 10 Oct, 2008
Posts: 4

Yes this was ment c#, didn't notice that last night and thank you very much for the answer, gonna test it later but first, more coffee
User is offlineProfile CardPM

Go to the top of the page

Wabbit
post 11 Oct, 2008 - 09:07 AM
Post #4


New D.I.C Head

*
Joined: 10 Oct, 2008
Posts: 4

QUOTE(gabehabe @ 10 Oct, 2008 - 02:49 PM) *

Sounds like this was meant for the C# forum~

Since each form is an object, let's say you want to get a string from Form1 to MainForm. Create a method (in Form1) something along the lines of this:
csharp
string info = "info";
string getInfo() {
return this.info;
}


To communicate with it from MainForm, you should have something like this:
csharp
void CommunicateWithForm() {
Form1 myForm1 = new Form1();
myForm1.ShowDialog();
MessageBox.Show(myForm1.getInfo());
}

Hope this helps smile.gif

Oh, and by the way~ if this wasn't meant for the C# forum, I apologise, but since it sounds like you're asking for C# advice, I'm moving it. If I'm wrong, let me know and I'll move it back.



I guess I explained wrong, I am not trying to pass data to another form, What I wonder is there any chans to pass data from a button with <%= %> code so I can use it back end, commadArgument almost do the trick but if I use <%= %> inside it will return the string <%= articleid %> not the value or I guess I'm doing something wrong, I try to limit the number of .aspx pages to mininum.

Hope you understand what I mean
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 11 Oct, 2008 - 09:17 AM
Post #5


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,921



Thanked 117 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Moved to ASP.NET smile.gif
User is online!Profile CardPM

Go to the top of the page

narven
post 11 Oct, 2008 - 06:13 PM
Post #6


New D.I.C Head

Group Icon
Joined: 6 Feb, 2005
Posts: 29



Thanked 1 times

Dream Kudos: 25
My Contributions


http://www.codeproject.com/KB/cs/PassDataWinForms.aspx

hope that helps
User is offlineProfile CardPM

Go to the top of the page

Wabbit
post 13 Oct, 2008 - 09:53 PM
Post #7


New D.I.C Head

*
Joined: 10 Oct, 2008
Posts: 4

QUOTE(narven @ 11 Oct, 2008 - 07:13 PM) *



Thanks Narven, it really helped me.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 03:18PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month