473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

CLASS PROBLEM

<%@ WebService Language="C#" Class="Tecrube" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://www.aaaa.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Tecrube : System.Web.Services.WebService {
public DateTime Tarih;
public Tecrube()
{
Tarih = DateTime.Now;
}

[WebMethod]
public string MerhabaDunya()
{
return Tarih.ToString();
}

}

Using System;
using System.Windows.Forms;

namespace WS_Tecrube_01
{
public partial class Form2 : Form
{
private WebSeTcrb.Tecrube S;
public Form2()
{
InitializeComponent();
S = new WebSeTcrb.Tecrube();
}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = S.MerhabaDunya();
}
}
}

When i click the Button1 it returns the time when i clicked the button. I
suppose to see the time when the form initiliaze.
What can be the problem ?
Sep 5 '06 #1
2 1401
When you click the button, clientside javascript (inserted by ASP.NET)
resubmits the page, and the form data detects that we clicked this button
and invokes the button1_Click() handler. You are seeing the "S" from the
second drawing of the page. Incidentally, this usage will not use the
[WebMethod] - so this may not be requireed. If you need to persist the "S"
between calls, you will need to use state (either view-state or
session-state), as ASP.NET is generally stateless.

Marc
Sep 5 '06 #2
Hi,

You can call & store the value in Form2's constructor:

public partial class Form2 : Form
{
private WebSeTcrb.Tecrube S;
string s;
public Form2()
{
InitializeComponent();
S = new WebSeTcrb.Tecrube();
s = S.MerhabaDunya();
}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = s; }

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Savas Ates" <in da clubwrote in message
news:e2**************@TK2MSFTNGP06.phx.gbl...
<%@ WebService Language="C#" Class="Tecrube" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://www.aaaa.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class Tecrube : System.Web.Services.WebService {
public DateTime Tarih;
public Tecrube()
{
Tarih = DateTime.Now;
}

[WebMethod]
public string MerhabaDunya()
{
return Tarih.ToString();
}

}

Using System;
using System.Windows.Forms;

namespace WS_Tecrube_01
{
public partial class Form2 : Form
{
private WebSeTcrb.Tecrube S;
public Form2()
{
InitializeComponent();
S = new WebSeTcrb.Tecrube();
}

private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = S.MerhabaDunya();
}
}
}

When i click the Button1 it returns the time when i clicked the button. I
suppose to see the time when the form initiliaze.
What can be the problem ?


Sep 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve | last post by:
Hello, I'm encountering an unexpected behavior when using the "new" modifier in a derived class to hide an inherited base class property. I use "new" intentionally so I can change the Type of...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
21
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class...
21
by: Mark Broadbent | last post by:
Consider the following statements //------- Item i = Basket.Items; //indexer is used to return instance of class Item Basket.Items.Remove(); //method on class item is fired item i = new...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
8
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background...
4
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. Here we have a class called B One project...
5
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
3
by: TamusJRoyce | last post by:
Hello. This is my first thread here. My problem has probably been came across by a lot of people, but tutorials and things I've seen don't address it (usually too basic). My problem is that I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.