|
hmm. u r right..
i dont know exactly what happens behind when we use the 'using' in C#.
plz explain me..
|
|
|
|
|
please Rewrite your question in order to understand your problem.
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Actually, we are developing an application to test the User Load for any Website..
below is the script of our tool that loads virtual user and tests the site..
using System;
using RTGWebLoad;
namespace Coolgoose
{
public class Transaction
{
private string username;
private string password;
public void TransactionMain(RTGHttpBrowser wlHttp, string ThreadNum, long RoundNum, long MaxRounds)
{
wlHttp.BeginTransaction("Coolgoose_SendingMail");
CallCoolGooseSendMail(wlHttp, ThreadNum, RoundNum, MaxRounds);
wlHttp.EndTransaction("Coolgoose_SendingMail");
}
public void CallCoolGooseSendMail(RTGHttpBrowser wlHttp, string ThreadNum, long RoundNum, long MaxRounds)
{
if (RoundNum == 1)
CGLogin(wlHttp);
CGSM(wlHttp);
}
public void CGLogin(RTGHttpBrowser wlHttp)
{
string[] loginData = wlHttp.GetData("http://10.80.4.43/?get=userpass", ',');
username = loginData[0];
password = loginData[1];
wlHttp.Get("http://www.cooltoad.com");
wlHttp.InfoMessage("Page1: " + wlHttp.wlSource);
wlHttp.Get("http://www.cooltoad.com/go/email");
wlHttp.Get("http://www.cooltoad.com/account/login.php?mail=1");
wlHttp.ContentType = "application/x-www-form-urlencoded";
wlHttp.FormData("ACCOUNT", username);
wlHttp.FormData("PASSWORD", password);
wlHttp.Post("http://www.cooltoad.com/account/login.php?mail=1");
wlHttp.Get("http://www.cooltoad.com/common/header_email.php");
wlHttp.Get("http://as03.cooltoad.com/go/desktop?p=folders");
wlHttp.Get("http://as03.cooltoad.com/go/desktop?o=folder:inbox");
wlHttp.InfoMessage("------" + username + " logged IN ------");
}
public void CGSM(RTGHttpBrowser wlHttp)
{
wlHttp.Get("http://as03.cooltoad.com/go/desktop?c=new");
string sCompose = wlHttp.FindString(wlHttp.wlSource, "COMPOSE\" VALUE=\"", "\">");
wlHttp.ContentType = "multipart/form-data";
wlHttp.FormData("TO", "xyz@gmail.com");
wlHttp.FormData("CC", "");
wlHttp.FormData("SUBJECT", "Testing LTT -- Naveed");
wlHttp.FormData("ATTACHMENT_DATA.wlFile-Name", "");
wlHttp.FormData("ATTACHMENT_DATA.wlContent-Type", "application/octet-stream");
wlHttp.FormData("MESSAGE", "Testing LoadTestingTool");
wlHttp.FormData("TZO", "-330");
wlHttp.FormData("C:SEND:::NEW.x", "12");
wlHttp.FormData("C:SEND:::NEW.y", "9");
wlHttp.FormData("COMPOSE", sCompose);
wlHttp.Post("http://as03.cooltoad.com/go/desktop");
wlHttp.InfoMessage("Compose: " + sCompose + " --- " + username);
}
public void CGLogout(RTGHttpBrowser wlHttp)
{
wlHttp.Get("http://as03.cooltoad.com/go/desktop?c=logout");
wlHttp.ClearCookies();
wlHttp.InfoMessage("------" + username + " logged OUT ------");
}
}
}
after writing this script we wil pass this to our Testing tool, which compiles this C# script and starts the run.
we want to tune our code, so that we can write this script in more better way..
currently the InfoMessage() functions are in the same package RTGWebLoad..
we want to move it to another package and can be called without an object or class name..
one of my mate suggest me to include the package's code as we do in C (using #include).
regards,
nas
|
|
|
|
|
Your mate is thinking the wrong way for C#.
You can wrap this code in to a class library of its own. Then you can reference the class library from where it is needed, if it is needed in multiple projects.
|
|
|
|
|
nasambur wrote: i dont know exactly what happens behind when we use the 'using' in C#.
plz explain me..
Using can be used in two places. In the context of this conversation you mean the way using is used as a directive to import namespaces into the current code file.
Using allows the developer to call the class name on its own rather than be forced to use its full name. e.g.
using System.Data.SqlClient;
...
SqlConnection connection = new SqlConnection();
or
System.Data.SqlClient.SqlConnection = new System.Data.SqlClient.SqlConnection();
|
|
|
|
|
|
nasambur wrote: i want to include a file, similarly as of #include.
C# has no need of that funtionality.
If you want to be able to use classes, structs, etc. from other namespaces without having to refer to it fully each time use add the appropriate using directive at the top of the class file.
You may also have to add a reference to the appropriate assembly that contains the code. To do this, right-click on the project you wish to add the reference to and select "Add Reference...". The dialog contains various tabs that indicate where the assemby is.
|
|
|
|
|
Sorry, but what is the big deal about calling ClassName.Func1() ?
It is better to package these functions up in to an appropriate set of classes. It provides better logical separation.
|
|
|
|
|
Hi
Can anybody helpme out to get the grasph control where we can draw multiple plots in the same graph.
Regards,
Rocky.
|
|
|
|
|
|
Hi All,
I need to display time in the following format:
7:40a (not AM/PM whole word just A/P in lowercase)
So how could I achieve this?
|
|
|
|
|
I think
string strDT = <datetime instance="">.value.toShortDateTimeString().Replace("AM","a").Replace("PM","p");
It can be a bad way but it's a simple way
|
|
|
|
|
Thanks buddy,
it is working fine.
|
|
|
|
|
Hi,
I have already used the Camtasia SW, but the file that create is very bulky, therefore I like to find some coding for .NET compatible SW.
I have found another SW called TerboDemo(7.5 trial version), which captures the screen as an array of screenshots, which also take big capacity. It saves in .tdp format.
Please help me to find a .NET cording.
Thanks and Regards
khema
|
|
|
|
|
Hi
I have created a datagrid and i have bound that datagrid with the result from the query. I have a table of purchase which i have bound with the datagrid. But now i want that whenever a person clicks anyof the row of purchase it must display the purchase details in the form of table or grid.
How can i do that?
Please hlep me
KHATRI
|
|
|
|
|
Hi you.
You are saying about hierachical data, called master-detail data. You can completely do it.
First, you make a dataset contains two table: PURCHASE and PURCHASEDETAIL. And you also make an internal relation among two tables with a "PURCHASE.ID = PURCHASEDTAIL.pID" datarelation. See next.
Second, you assign Datagrid's Datasource into this dataset.
That's all. It is working like you want .
Hope my help.
|
|
|
|
|
Yes but how it will show in datagrd.. i mean how ill gonna implement that..
like First i m calling a Purchase table in a dataset and bounding it.
Then on click it will request for the details of the table for the particular purchase id. The result will be shown in another datagrid showing heirarchial or master child relation.
KHATRI
|
|
|
|
|
|
I m not asking for ASP.NET . I am asking for Windows Form.
I am not creating application for webdevlopment its basically an Windows Application. over there I have to use datagrid with nested or master child relation.
KHATRI
|
|
|
|
|
Hi,
I want to baind only images(.bmp, gif, jpeg, etc) in combobox...Can any one help me on this..
Regards,
Sivaprasad
|
|
|
|
|
I need to send WM_COPYATA to another process from a C# program. Is there a C# method (maybe a class) equivalent to the Win32 API SendMessage(HWND h, ...) ?
|
|
|
|
|
MSDN[^]Article will help you.
Regards,
Satips.
|
|
|
|
|
Thanks , Satips.
|
|
|
|
|
Thanks, Satips, but in fact it didn't help me. I'm converting a working MFC program to C# and the only thing I stuck on is sending WM_COPYDATA message to another process, and the article doesn't say which method or class I should use (maybe I should use interop ?). Thanks anyway.
|
|
|
|
|
You could simply use P/Invoke SendMessage using this[^] p/invoke declaration. To get the window handle of the other process, you can use Process.GetProcess to get the process object for the other process and then use the MainWindowHandle property to get the window handle.
You would also need to use the actual value of WM_COPYDATA (0x004A), as that enum doesn't exist in C#.
|
|
|
|