|
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
|
|
|
|
|
You need to remove the reference to Project 1 from Project 2 whenever you get this error.
Then build Project1. restablish the reference and then build all.
This should resolve the error.
Cheers
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
Ravindra,
Thanks for the note. I tried that and it worked. I wonder if the condition will evolve again over time? What is the cause of this problem? Is this something that will be fixed in the IDE?
Ward
Frag
Try, Fail..Fail, Succeed
Tool Developer
Michigan, USA
|
|
|
|
|
I use the Process.GetProcessesByName-Method to retreive all processes, having the same name. In certain circumstances this processes run under different users. How can I find out which user runs which process?
Completely different methods than using System.Diagnostics.Process are also appreciated.
Thanks.
|
|
|
|
|
You can get this info by using the System.Management namespace functions. I do not have an example in c#, but I have one in vb.net if you are interested.
Basically:
System.Management.ConnectionOptions con = new System.Management.ConnectionOptions;
System.Management.ManagementScope mgmtScope = new System.Management.ManagementScope("\\localhost", con);
System.Management.ObjectQuery objQuery = new System.Management.WqlObjectQuery("SELECT * FROM win32_process");
System.Management.ManagementObjectSearcher objSearch = new Management.ManagementObjectSearcher(mgmtScope, objQuery);
System.Management.ManagementObjectCollection objCol = objSearch.Get;
Object obj;
//Loop through all the processes in objCol to find the one you want.
foreach(System.Management.Object objProc in objCol)
{
//if the obj is the proc you are after
obj = objProc.InvokeMethod("GetOwner",info); //where info is an array look at docs
//I think info[0] is domain and info[1] is user
}
This example code was cobbled together in the message reply editor, and I do not use c# enough to say that these are valid statements, but if you read the documentation on the System.Management objects used, you should be able to figure it out.
Scott Serl
|
|
|
|
|
Hi all,
I new a solution file and then added 2 new projects in there. the project were
1) Smart Device Application
2) ASp.Net web service
I added a sample string helloworld() web service to 2) and then I added a form with a text box and a button to 1).
When the mobile simulator (default pocket pc) on .net is running, pressing the button on the form will call the web
service 2) helloworld and helloworld returned things will display on the text box of the form.
I hv also added 2) as 1)'s web reference.
the solution compiled and deployed successfully. But when I press the button to call the web service, an error
message has been displayed, telling project 1) cannot find web services of project.
Any idea on this problem?
thanks much.
Rene Xavier
|
|
|
|
|
Hi,
Using localhost can cause this type of problem. If you are using the localhost in the URL use your machine name instead of localhost in the URL.
Thanks and Regards
SGS
|
|
|
|
|
Hi,
I got your point, it seemed the client can found webSrvProj now. But when I access statement 2 as below:
webSrvProj.webSrv webSrv = new abc.webSrvProj.webSrv();
this.textBox1.Text = webSrv.CallExternalWebService(); // this web service just write a "hello world"
exception still raised
System.Net.WebException
Additional information: The remote service returned an error: (401) Unauthorized
Any idea ? Who grant right to who? And how to grant rights? As I remembered that I hv grant all IIS access priviledges on both mobile client application and the web service application.
Thanks in advance!!!
Rene Xavier
|
|
|
|
|
Hi,
I dont have an exact solution for this. But are you able to aceess your webservice from a remote machine. Please check that.
Thnaks
SGS.
|
|
|
|