|
Hey, thanks for the great reply.
However if i got an 3 arraylist to be serialize, one of them is an arraylist containing graphicspath, how do i deserialize them back to the 3 different arraylist. Should i save the number of items in each of the arraylist?
Below is how i put all the arraylist into a single arraylist
ArrayList arr = new ArrayList();<br />
<br />
arr.Add(Arraylist1);
for(int i=0;i<ArrayList2.Count;i++)
{<br />
GraphicsPathData gpd = new GraphicsPathData((GraphicsPath)PathList[i]);<br />
Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
arr.Add(gpdStream);<br />
}<br />
<br />
arr.Add(Arraylist1);
<br />
formatter.Serialize(myStream, arr);<br />
myStream.Close();<br />
What other method do you suggest?
Thanks in advance
|
|
|
|
|
The thing you are doing is going to work and is ok
and Yes if you are using arrays you must know what data is where
for preventing this you can use HashTable and use Enum or string names for keys
these are wrote down here are just suggestions
how about to create a GraphicsPathDataCollection Class and pass those GraphicsPaths to it and Serialize/ Deserialize the GraphicsPathDataCollection and take back your array of GraphicsPath after Deserializing.
this needs some coding but is the correct way because you have a collection and maybe some other time you simply modify it for other use (like import and export...)
there is an easier way too just like you did, but you can put all your GraphicsPathData inside a ArrayList not their serialized streams then Serialize the Array because as you know serializing is not such a fast job exeptionaly if you use SoapFormatter and in this way lots of resources going to be wasted.
and one another thing if you are using .Net2.0 why we don't use List<> instead of ArrayList if all of our data are the same!.
enum myPhases {gpData /*and other things you need to serialize */};
HashTable tableMustbeSerialized=new HashTable();
List<GraphicsPath> gpList; //your Graphicspaths
List<GraphicsPathData> gpdList=new List<GraphicsPathData>();
foreach(GraphicsPath gp in gpList)
gpdList.Add(new GraphicsPathData(gp));
.
.
.
//other things must be Serialized
tableMustbeSerialized.Add(myPhases.gpData ,gpdList);
.
.
.
//add other Data too
formatter.Serialize(myStream, tableMustbeSerialized);
myStream.Close();
and of course after deserializing it can be easier retrieved
object deserializedObject;
HashTable myData=deserializedObject as HashTable;
List<GraphicsPathData> gpdList=myData[myPhases.gpData] as List<GraphicsPathData>;
if you need help I'm here
good luck
|
|
|
|
|
Hi,
I created a VC++ MFC static Dll and wrote a function with __decl(dllexport).Then I created C# wrapper on top of the VC++ MFC Static DLL and tried to call the method in wrapper DLL through a sample windows application in C#.But i could not proceed as i got an errer i.e. Unable to find entry point for that menthod.
|
|
|
|
|
there is a property called allow paging =true, in vb.net datagidview.
can i directly allow the paging =ture in c# datagidview.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
what application did u build?
a Web Apps or a Win App
Regards,
Tomi
|
|
|
|
|
window app
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Since you said below that it is a Windows application, I don't know how you found an AllowPaging property in VB.NET. Properties are not artefacts of the language you are using, but of a class. A control, like the DataGridView, has the same properties whatever language it is used in, and the Windows forms DataGrid view doesn't have an AllowPaging property at all.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway
My New Blog
|
|
|
|
|
Basically I want to use COM Interop facility and expose some functionality from my .Net application (made in 2.0 n above)to COM Client (which can be any application in VB 6.0 or c++). My requirement is when COM client makes a call to my .net component, my .Net application should start in the background and after the work is over .net application should stop automatically. So to fulfill this I will have to make COM+ Servers. Now as my component is in exe form, I understand that I will have to create a Out proc server. But in .net I don't find any easy way to register my application as out proc.
I searched the web and also code project site but not to much help. On code project site I found some useful information but the way of implementation shown is bit too difficult. (Pls visit : http://www.codeproject.com/useritems/BuildCOMServersInDotNet.asp[^])
Is there any easy way to fulfil my requirement in easier way? Pls advice.
regards,
Krunal
|
|
|
|
|
am I not clear with my question or its tough nut to crack for fellow mebers. If you want further clarification on question pls get back to me. I'm eagerly waiting for some response...
|
|
|
|
|
It's not too hard to crack. It's just too easy to Google[^].
|
|
|
|
|
[CODE]
private void CreateMaze(int h, int w)
{
int r = h * w;
Room[] rooms = new Room[r];
Random rm = new Random();
int newrm = rm.Next(0, r);
int nrmcntr = newrm;
do
{
rooms[newrm].rWall = "|";
if (newrm == rooms.Length() -1)
{
newrm = 0;
}
newrm += 1;
}
while (newrm != nrmcntr);
[/CODE]
At the line:
if (newrm == rooms.Length() -1)
I am trying to compare an integer to the last index of an array of room objects.
I get the error:
Method name expected
at that line but have no clue.
Thank you in advance for any explanations.
|
|
|
|
|
Length is a Property for arrays not a Method
use rooms.Length-1 instead of rooms.Length()-1
good luck
|
|
|
|
|
i want to pass for example an employeeid which exist in the first form and on clicking the button the second form appear containing all data (firstname,lastname,hiredate,....)for this employeeid
dina
|
|
|
|
|
Pass it in the constructor, or via public properties. If form2 is not a child of form1, pass it using a delegate.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I Have a function that takes arguments and process and return a dataset (the scenario is working fine), Now i need to put my function in thread but unable to find any way to pass arguments to thread and take return argument from thread.
Totally clueless to threads,
Please Help!!!!
Thank you!
M. Nauman Yousuf
"Mess with the Best, Die like the rest"
|
|
|
|
|
Hi,
have a look at the BackgroundWorker class, that is intended for such situations.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I will look in to it, thx Luc Pattyn
"Mess with the Best, Die like the rest"
|
|
|
|
|
if you are using framework 2 then i think there is some thing called parametrize thread. if you are using frame work 1.1 then have a function in a different class which doesnt take any parameter but use class level variabe in that class pass the parameter through constructor and and in the method use those mvariable. and call that method using thread.
|
|
|
|
|
I want to load data from sql server table to a datagridview using threading and I want to display the loading progress in progressbar. Please help.
Kutty
|
|
|
|
|
Hi,
typically loading data from a database is a single, atomic, operation, which gets launched,
executes, and returns when done; the client simply waits while the server is
gathering the requested data. So progress information is simply not available.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I found a solution during my googling. But it is not working in my case, can any body please check this code.
this what I found:
public partial class Form1 : Form
{
public static string ConnectionString = "" //your connection string here
DataSet DS = new DataSet();
double TotalRows =0;
double RowIndex = 1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection DBConn = new OleDbConnection(ConnectionString);
OleDbDataAdapter DBAdapter = new OleDbDataAdapter();
DBAdapter.SelectCommand = new OleDbCommand("SELECT Count(*) from tblPersons", DBConn);
DBConn.Open();
TotalRows = (int)DBAdapter.SelectCommand.ExecuteScalar(); //retrieve the nr. of rows in the DB Table
DBConn.Close();
DBAdapter.SelectCommand.CommandText = "SELECT * from tblPersons";
DS.Tables.Add(new DataTable("Customers"));
// Add event handler to the row changing event in the dataset
DS.Tables["Customers"].RowChanging += new DataRowChangeEventHandler(Form1_RowChanging);
DBAdapter.Fill(DS, "Customers");
dataGridView1.DataSource = DS.Tables[0];
}
void Form1_RowChanging(object sender, DataRowChangeEventArgs e)
{
if (e.Action.ToString() == "Add") //check if the action is 'Add' (not 'Commit')
{
Thread.Sleep(500);
progressBar1.Value = (int)Math.Round((double)(RowIndex / TotalRows) * 100); //update the progressbar
progressBar1.Refresh();
RowIndex++; //count rows
}
}
}
}
Kutty
|
|
|
|
|
Hi All
I wount set the type of column in DataGridView to combobox how i can do that
and I wount to set his DataSourc to Specifyic Table How i can do that
thanks for any body help me
Thaer
|
|
|
|
|
Hi - nobody helped you 5 hours ago as your question is poorly formed, doesn't make sense and doesn't tell anybody what you have actually tried already to solve your problem.
Posting the same question again is NOT going to make sometbody suddenly thing - "oh darn, I didn't answer Thaer's question - I better do it now."
Form you questions in a clear, concise way, state exactly what the problem is what 'what you have tried to solve it' and you watch the difference.....you will not have to post it twice either. People here WANT to help - but will only help those that want to help themselves, and not those that just want their work doing for them.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
i have a setup project setup1 which deploys two windows services windows
service1,windows service2.i also added some custom installation actions into
it using projectinstaller.cs.In windowsservice1 oninstall event,i attached a
database ;(create database for attach command) .
in windowsservice2 onuninstall event,i deletes the databse using "drop
database";
the setup exe installs the windows services successfully.but when i
uninstall them, the drop database does not work as sql server places a lock
on mdf files.(cant drop database as mdf file is in use).how can i solve this
problem. Also since uninstall operation is not transactional, only the
windowsservice1 gets uninstalled. when i again try to uninstall ,it shows
"the specified service does not exist as an i nstalled service"(probably the
setup again tries to unstall the already uninstalled windowsservice1).
How can i solve these problems?
i need a way to unlock the mdf files before executing drop database
command
And in unstall event of windows service 1, i need a way to check if it is
already uninstalled
public override void UnInstall()
{
how to check whether the service already uninstalled()?;
base.Uninstall();
}
|
|
|
|
|
Are you sure dropping the database is such a good idea??
What say you just want to upgrade the service??
Ta
Paul
Help, Urgent, Need answers Urgent, Quick Help arggggghhhhhhhhhh
|
|
|
|