|
jojoba2010 wrote: Point
System.Drawing.PointConverter
jojoba2010 wrote: Font
System.Drawing.FontConverter
jojoba2010 wrote: Color
System.Drawing.ColorConverter
|
|
|
|
|
looks like you need xml deserialization. That is, having an object represented as an xml string, deserialize it in the proper class.
Is that the case?Best regards,
Jaime.
|
|
|
|
|
No
I have string and want to cast it to (color,point,font,...)
|
|
|
|
|
jojoba2010 wrote: I have string and want to cast it to (color,point,font,...)
You cannot do this, a string is just a collection of characters. If you want to create some other object from it then you need to parse the string, extracting the relevant fields and create new objects based on that data.
Read the documentation on what casting is, it does not convert one object to another.MVP 2010 - are they mad?
|
|
|
|
|
Richard MacCutchan wrote: MVP 2010 - are they mad?
Nope i don't think so! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
You are too kind my friend. MVP 2010 - are they mad?
|
|
|
|
|
what actuallly coming into your string! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
From what I read in the thread you're not really helpful in providing information.
Note that we don't have any background on what you need to do or what you've done so far.
Please elaborate a little on the problem. Where does the input come from? In what format is it set (XML, flat file, CSV,...)? Is there metadata included? What different types of 'classes' are we talking about? etc...
If you want help you'll need to be more specific.V.
|
|
|
|
|
The word you are looking for is "parse". Many classes have a "Parse" method. For example:
int x = int.Parse("1");
To parse Point strings, you can use the System.Drawing.PointConverter class. For other classes, find the parse methods or create them yourself.
|
|
|
|
|
Hi..
I'm using sql server 2005 Standard Edition and vs 2005
im trying to get database backup & restore with c# coding its succesfull run in my machine.(Using smo namespace)..my machine are installed management studio so smo retrive server name and DB..
But when i was create exe this backup application and run client machine its not run.. Bcoz client machine only installed express edition not in management studio.. Client machine have some software with Database(path c:\Program Files\Test\) in this case how can i get backup & Restore in client machine...?
Pls help me..?
|
|
|
|
|
you can take help from Here[^]
|
|
|
|
|
Also im trying this..
That's also using smo retrive server name and DB with connect management studio..
But I need all project DB backup without installed management studio, only installed express edition..Bcos client machine have express edition not in management studio..
Any idea.
|
|
|
|
|
PropertyInfo propertys = control.GetType().GetProperty("Font");
tc = System.ComponentModel.TypeDescriptor.GetConverter(propertys.PropertyType);
propertys.SetValue(control, (<big><code>?</code></big>)"Arial", null); modified on Tuesday, February 9, 2010 2:10 AM
|
|
|
|
|
|
Hi
I'm newbie in NHibernate. I've downloaded example from: https://www.hibernate.org/379.html[^]
I can retreive data from database via iquery but i have a problem when I try save data.
Here is code:
Supplier supplier = new Supplier();
supplier.Name = "Supplier5";
Manufacturer manufacturer = new Manufacturer("manufacturer5");
Product product = new Product();
product.Name = "product5";
product.Supplier = supplier;
supplier.ProductList.Add(product);
manufacturer.ProductSet.Add(product);
product.ManufacturerSet.Add(manufacturer);
ITransaction transaction = Session.BeginTransaction();
try
{
Session.Save(supplier);
transaction.Commit();
}
catch (NHibernate.HibernateException nexp)
{
}
I've got an error:
error performing isolated work
InnerException: {"Object reference not set to an instance of an object."}
Here is mapping file supplier.hbm.file:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" default-access="nosetter.camelcase">
<class name="NHibernateExampleApp.Supplier, NHibernateExampleApp" table="SUPPLIER" lazy="true" mutable="true">
<id name="SupplierId" unsaved-value="0" column="ID_SUPPLIER" type="System.Int32">
<generator class="hilo">
<param name="table">hibernate_unique_key</param>
<param name="column">next_hi</param>
<param name="max_lo">10</param>
</generator>
</id>
<bag name="ProductList" table="PRODUCT" cascade="all" fetch="join" inverse="true">
<key column="FK_SUPPLIER" />
<one-to-many class="NHibernateExampleApp.Product, NHibernateExampleApp" />
</bag>
<property name="Name" column="NAME" not-null="true" type="System.String" />
</class>
<query name="suppliers">from Supplier</query>
</hibernate-mapping>
StackTrace:
" at NHibernate.Transaction.AdoNetTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory.ExecuteWorkInIsolation(ISessionImplementor session, IIsolatedWork work, Boolean transacted)\r\n at NHibernate.Engine.Transaction.Isolater.DoIsolatedWork(IIsolatedWork work, ISessionImplementor session)\r\n at NHibernate.Engine.TransactionHelper.DoWorkInNewTransaction(ISessionImplementor session)\r\n at NHibernate.Id.TableGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Id.TableHiLoGenerator.Generate(ISessionImplementor session, Object obj)\r\n at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.Save(Object obj)\r\n at NHibernateExampleApp.Form1.NHTest() in D:\\rg\\proj_CSharp\\NHibernateExampleApp\\NHibernateExampleApp\\Form1.cs:line 136"
I can see that is a problem with hilo.
I have table: hibernate_unique_key
Column next_hi has value 0
Could someone help me?
ThanksI
modified on Tuesday, February 9, 2010 1:44 AM
|
|
|
|
|
Ok, sorry, problem is resolved. I
|
|
|
|
|
Hello,
Datagridview OrderView;
In the above Datagridview my 2nd column is a checkboxcolumn
Rectangle contentBounds = OrderView.Columns[2].CellTemplate.GetContentBounds(0);
But I cant get the contentBounds of the check box
I m getting the rectangle as x=0 y=0
But actually the checkbox column is made and checkbox appears in the first row.
How can I get the bounds ?
thank you
|
|
|
|
|
|
Don't point back to a previous post I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I'm sorry.
But anybody know how to fix this problem ?
Please help me.
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
Writing shell extensions in anything but .NET 4.0 is not supported and highly inadvisable. You've been shown the article describing why.
|
|
|
|
|
I'm currently writing a wrapper for Fossil (www.fossil-scm.org[^]).
I'm trying to pass two double quoted arguments to cmd.exe, but there seems to be a problem with my command and I can't find what's wrong with it.
here's a snippet of my code:
var proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/c " + Command;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.CreateNoWindow = true;
Debug.WriteLine(proc.StartInfo.Arguments);
proc.Start();
Output = proc.StandardOutput.ReadToEnd();
Here are my cases:
======
1
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new \"C:\\Documents and Settings\\Simon\\Bureau\\test1\""
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
Output: "" (doesn't work in my project, but using the same command directly in cmd.exe does work. I don't understand why.)
======
2
proc.StartInfo.Arguments: "/c \"C:\\Documents and Settings\\Simon\\Bureau\\Fossil\\fossil.exe\" new C:\\hello\\testing\\test1"
Debug.WriteLine: /c "C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new C:\hello\testing\test1
Output: *works as expected*
======
There seems to be a problem with my second double quoted string, but I don't understand why.
I would be really grateful if anybody could help me on this. I plan to offer this project to the community and it is pretty much my main problem currently.
Thanks a lot.
If it might help: I'm developing with VS.Net 2008 SP1 in C# with the .Net 3.5 Framework.
(I did try looking for answers in the forum, google and other sources, but couldn't find an answer for it.)
|
|
|
|
|
Hi,
I've had such experience long ago. IIRC the proper way to do it is to use double quotes around the smallest chunk of text needing it, so try ...\\"Documents and Settings"\\... , and yes that is a pain.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
I followed your suggestion and..
changed:
"C:\Documents and Settings\Simon\Bureau\Fossil\fossil.exe" new "C:\Documents and Settings\Simon\Bureau\test1"
to:
C:\\"Documents and Settings"\\Simon\\Bureau\\Fossil\\fossil.exe new C:\\"Documents and Settings"\\Simon\\Bureau\\test1
It works flawlessly.
Thanks a lot Mr. Pattyn.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|