|
Thanks you Pushkar:
I guess your code is right to window form, but I'm using web form.
What would be equivalent code in web form to
System.Windows.Forms.Form?
And how can I call Hay_PostBack from my web form?
maybe:
bool que = WUC_CreDes.Class1.Hay_PostBack(this, w1,w1cx, w1ID, w2, w2cx, w2ID);
Please help me.
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
I’ve continued working on my code, it’s now thus:
public static bool Hay_PostBack(System.Web.UI.Page parent1, string w1,
string w1cx,
string w1ID,
string w2,
string w2cx,
string w2ID)
{
WUC_CreDes.WebForm1 frm1;
WUC_CreDes.WebForm2 frm2;
string fofoi = parent1.GetType().ToString();
if(fofoi == "ASP.WebForm1_aspx")
{
frm1 = (WUC_CreDes.WebForm1) parent1;
frm1.parent1.Example.Controls.Clear();
}
}
Yet in last line: frm1.parent1.Example.Controls.Clear();
It’s giving me error: WUC_CreDes.WebForm1' doesn’t contains a definition to 'parent1'.
Example is a place holder contening both in WebForm1 and in WebForm2.
I’ll thank your help.
A.L.
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
Finally I found the solution:
To call function:
bool que = WUC_CreDes.Class1.Hay_PostBack(this, w1,w1cx, w1ID, w2, w2cx, w2ID);
The function:
public static bool Hay_PostBack(System.Web.UI.Page parent1, string w1,
string w1cx,
string w1ID,
string w2,
string w2cx,
string w2ID)
{
WUC_CreDes.WebForm1 frm1;
WUC_CreDes.WebForm2 frm2;
string cual = "";
cual = HttpContext.Current.Session["par1"].ToString();
string fofoi = parent1.GetType().ToString();
if(fofoi == "ASP.WebForm1_aspx")
{
frm1 = (WUC_CreDes.WebForm1) parent1;
frm1.Example.Controls.Clear();
if(cual == w1)
{
Control control = frm1.Page.LoadControl(w1cx);
control.ID = w1ID;
frm1.Example.Controls.Add(control);
}
else
{
Control control = frm1.Page.LoadControl(w2cx);
control.ID = w2ID;
frm1.Example.Controls.Add(control);
}
}
else
{
if(fofoi == "ASP.WebForm2_aspx")
{
frm2 = (WUC_CreDes.WebForm2) parent1;
frm2.Example.Controls.Clear();
if(cual == w1)
{
Control control = frm2.Page.LoadControl(w1cx);
control.ID = w1ID;
frm2.Example.Controls.Add(control);
}
else
{
Control control = frm2.Page.LoadControl(w2cx);
control.ID = w2ID;
frm2.Example.Controls.Add(control);
}
}
}
return false;
}
Greetings.
A.L.
El hombre que tiene amigos debe mostrarse amigo...
|
|
|
|
|
Hello all,
I have an application which runs as a windows service. When it starts up it processes a number of interfaces and sets up a timer for each of the interfaces using System.Timers timers.
If two interfaces are scheduled to run at exactly the same time the OnTimedEvent() method only gets called for one of the interfaces. If the interfaces are scheduled to run at different times everything runs fine.
As a test I knocked together a quick and dirty app using Threading.Timers and these work fine. However to re-write the service to use them would be a last resort. Also the .NET documentation recommends using the System.Timers when writing server apps etc
Does anybody know what I may be doing wrong? Or has anybody experienced a problem like this before, so I can at least tell my boss it is a known problem
Thanks
Simon
|
|
|
|
|
Try locking your method so only 1 thread can access it at any given time:
private void myTimerEvent(object sender, EventArgs e)
{
lock(this)
{
...
}
}
|
|
|
|
|
|
When a window form is working, I would like to show a small form just to tell users "Please wait...", but it seems that when the main form is working, the small form can not appear correctly. How to solve this?
|
|
|
|
|
Use a thread to display the child form
Have a wonderful evening
Doug Wright
Developer, TDCI
|
|
|
|
|
Can you teach me a little about this? I am not sure I know much of threading
|
|
|
|
|
Threading is a sure solution. But if it is possible to solve things in other way then avoid threading. Immediately before your "heavy" processing starts launch the new form and give a Application.DoEvents (In C#) This should solve your problem, or else you can go for a thread.
|
|
|
|
|
Hi all,
Anyone knows how to use pivot table in .net(c#)
It works well in vb but it is not working in .net .
since i am new to this type of concepts .Help me
Prabhakar.A
Software Engineer
|
|
|
|
|
Let’s say we have a product table where each row represents product details like product Id, Name, Description , Price etc.
Now customer might be interested to view products across (i.e. columns) and features down (row wise). This basically requires transposing product table’s rows and columns as illustrated below.
The first step is to create the new Data Table and its schema from the rows of the input table. In the following code snippet, source refers to the input table and dest is the new pivoted table.
//Create Destination Table
DataTable dest = new DataTable("Pivot" );
// from each source table row (1st column)
// create a destination column
foreach( DataRow r in source.Rows )
dest.Columns.Add( r[0].ToString() );
// assign each row the Product name Now that we have the appropriate columns defined
in the schema of the destination table, the next step is to create a DataRow for each feature defined in the columns of the source table, excluding the first column representing the Product name.
//Create columns in destination table for each row in source table.
for( int i = 0; i < source.Columns.Count - 1; i++ )
dest.Rows.Add( dest.NewRow() );
The final step is the actual transform of the columns from the source rows into the destination table. Since each table now represents a two dimensional array of its rows and columns, a very simple transform of all columns and rows could be performed by the following nested for loop.
//Transpose rows and columns
for( int r = 0; r < dest.Rows.Count; r++ )
for( int c = 0; c < source.Columns.Count; c++ )
dest.Rows[r][c] = source.Rows[c][r];
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
Thanx,
But I am asking Microsoft Office Pivot Table 9.0 component in asp.net
Prabhakar.A
Software Engineer
|
|
|
|
|
I have two classes named Table and Column.
In Table object, I have many instances of Column object. And in each Column object, I have a property named Table which will return the Table object that this Column object belongs to.
Let see this:
public class Table
{
private name;
private Column[] columns;
public string Name
{
set{name = value;}
get{return name;}
}
public Column[] Columns
{
set{columns = value;}
get{return columns;}
}
}
public class Column
{
private name;
private Table tableParent;
public string Name
{
set{name = value;}
get{return name;}
}
public Table TableParent
{
set{...}
get{...}
}
}
public class Use
{
Table t = new Table();
t.Name = "table";
Column[] cs = new Column[2];
cs[0].Name = "column1";
cs[0].TableParent = t;
cs[1].Name = "column2";
cs[1].TableParent = t;
//Change property of t object
t.Name = "tableChanged";
// I have to change TableParent of each column object manually
for(int i=0;i
|
|
|
|
|
Huh? Your Column objects are holding a reference to a Table object each, so changing the properties of the table means changing the property of the object your references are pointing to.
No need to change the TableParent, it hasn't changed!
mav
|
|
|
|
|
Dear,
While I am using smart device application using C# under “Mobile Application Development Toolkit\Labs\Introduction_to_Windows_Mobile C#”
This is downloaded from http://msdn.microsoft.com/mobility/thekit/
I am getting the following error in Pocket PC 2002 emulator as(if u run without debugging).
PdaClient.exe –Unhan
A managed WebException occurred at SoapHttpClientProtocol::doInvoke+0x23f
Unable to connect to the remote server
SoapHttpClientProtocol::doInvoke+0x23f
SoapHttpClientProtocol::Invoke+0x9
PdaWs::GetAuthors+0x11
Authors::AuthorsLoad+0xd
Form::OnLoad+0x15
Form::_SetVisibleNotufy+0x1d
Control::set_Visible+0x1f
Application::Run+0x7
Authors::Main+0xa
OK to terminate
Please let me know the details of the error and how to correct this one.
Thanks & Regards,
Sivaji Raju.
|
|
|
|
|
Hi ,
I have a dataTable and this table is binded into 10 comboBoxes , but whenever I select an item in a combobox, all the comboBoxes change their value too. I guess its because of habing same source,
is there any method to force to let the user select whatever he/she wants rather than changing tableName and binding each ComboBox unique ?
Thanks
Bahadir Cambel
|
|
|
|
|
Thats a great question!.
The dafault behaviour is windows forms creates at least one currency manager object for each data sources included in the form. The currency manager is managed through BindingContext object.
This behaviour is intentionally incorporated in order to keep all the controls on the form synchronized with data source.
For Instance if you have two combo boxes FirstName and LastName bound to dsCustomer, then if user changes FirstName, the lastname column also changes in order to reflect the correct customer. Windows forms moves binding context beind the scenes and programmer is relived of writing code to synchronize the controls.
If you do not want this feature, then you need to make a copy of the datasource and then bind it to combo boxes as illustrated in the code below.
private void Form1_Load(object sender, System.EventArgs e)
{
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter("Select top 10 * from authors", "Data Source=ITD2142s;Initial Catalog=pubs;Integrated Security=SSPI;");
ds = new System.Data.DataSet();
da.Fill(ds);
comboBox1.DataSource = ds.Copy().Tables[0] ;
comboBox1.DisplayMember = "au_lname";
comboBox2.DataSource = ds.Copy().Tables[0] ;;
comboBox2.DisplayMember = "au_fname";
}
Hope this helps .
Cheers
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
Thanks a lor Ravinda ,
I used .Clone() function but it didnt work..
Well at least I should have given one more try
I have a one more question , Is this copied dataTable will be stored logically or physically in memory ?
Thanks in advance..
Bahadir Cambel
|
|
|
|
|
Clone function will only copy the structure not the data.
Copy function will copy both structire as well as data.
Hence Copy function is more relevant in this case.
The copied data will be stored physically in memory.
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
Thanks again for great help...
Bahadir Cambel
|
|
|
|
|
hi
i am working in a windows form in C#. i have a datagrid which displays values from the table in the database. i know how to assign custom headers or rather to change the column names. now suppose i change the ordering of the columns, how will can i set the column names respectively without keeping a track of their order.
for eg.
if my datagrid is such
table name:software master
softwareid softwaredesc remarks
and i have given column names for them in the datagrid keeping their order into consideration as
code description remarks
now if the secondcolumn is to be shown as the third column,how can i change it so that even the custom column names are rearranged accordingly.
plss help
i have to create a common method which is to be called by more than form. in that case the columns of the grid are changing always.
regards
sukanya
|
|
|
|
|
One way is to use aliases for columns in SQL query itself.
e.g. the query can be
SELECT Softwareid as Code, softwaredesc as description, remarks as remarks
FROM SoftwareMaster
Cheers
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
I have a problem building a Solution. The solution contains 2 projects. Project1 is a DLL that supplies some business logic. Project2 is the Winforms Wizard. I have set the Project2 to be dependent on Project1 to build. Whenever I build the solution I get the following error:
------
The file 'Project1.dll' cannot be copied to the run directory. The process cannot access the file because it is being used by another process.
------
I am being driven slowly insane by this one. Please let me know if there is anything that I can do to handle this problem without having to shut down the IDE and destroy the obj directory for Project1.
Thanks in advance for your time and help
Ward
Frag
Try, Fail..Fail, Succeed
Tool Developer
Michigan, USA
|
|
|
|
|
I dont know the exact origin but whenever I have this error (very rarely) I switch the CopyLocal property of the reference to false. This way it doesnt copy the dll and thus doesnt have any conflicts
|
|
|
|