|
CodeMemberField field = new CodeMemberField("System.String", "NAME");
field.InitExpression = new CodePrimitiveExpression("CSharp");
field.Attributes = MemberAttributes.Const | MemberAttributes.Private;
field.Type = new CodeTypeReference("System.String");
|
|
|
|
|
Thanks Dave for both of your answers its all fine now........
hey Dave do you know how to creat regions using CodeDOM
and i have one more issue.....
all the statements inside a method or a constructor are aligned to the extreme left......
i want it to be properly indented.
for example:
public Data(string name, string age, string city)
{
this.m_name=name;
this.m_age=age;
this.m_city=city;
}
this i wat i am getting instead of getting a well indented code like:
public Data(string name, string age, string city)
{
this.m_name=name;
this.m_age=age;
this.m_city=city;
}
How do i get it indented....
|
|
|
|
|
Sorry Dave,
i don know how to add a section of code here....
both my indented version and non-indented version look the same above!!!! Sorry..... but i hope u got wat i wanted to say.......
i want the statement inside the method to be indented to one more tab towards right
|
|
|
|
|
You can specify a different indent string inside CodeGenerationOptions. But there isn't much else you can do, you might be better off just formating the document in visual studio afterwards.
CodeGeneratorOptions options = new System.CodeDom.Compiler.CodeGeneratorOptions();
options.IndentString = "\t";
cs.GenerateCodeFromMember(prop, w, options);
|
|
|
|
|
and wat bout getting the #region and #endregion Dave????
|
|
|
|
|
Are there any function for this ?
Thank =)
|
|
|
|
|
You can use the MeasureString() function in GDI+, it takes a string and a font and returns a SizeF object I believe containing the size of the string. I believe the function is available from the graphics object, not sure though..
|
|
|
|
|
Yes it is available, however it is stupidly an instance method of Graphics object, instead a static one, so one needs CreateGraphics().MeasureString(...) to do the trick.
Greetings - Gajatko
|
|
|
|
|
A font is rendered optimized for the output graphics. Hence measuring the size without specifying a graphics simply would not make sense.
And remember to dispose your graphics.
|
|
|
|
|
Thanks for knowledge Didn't know, really
Greetings - Gajatko
|
|
|
|
|
Hi,
I'm making a project which is now urgently need a function to convert arabic integer to roman interger. Does anyone tried to make this function?
I have searched a lot from web, but some of them seems work incorrectly or very complex. Could some of you provide me a code or example? Thank you.
|
|
|
|
|
|
Thanks so much Mujtaba,
It is useful, but is there any good source code that I can convert the arabic number from 1-10000 ? The java example is work fine only for the range of 1- 3999.
|
|
|
|
|
|
i need to browse and get two db file of few mb in first form and submit.
In second form i need to list all tables in two dropdown list respectively and click compare after selecting one table from each dropdown.
o/p should be in excel format with table column headers.
|
|
|
|
|
Sounds like someone took a rentacoder job and has no idea where to start....
What sort of files are they, .mdb ?
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 )
|
|
|
|
|
Step : 1
Save both mdb file any default location with name 1.mdb and 2.mdb
Step: 2
String connect1 ="Provider=Microsoft.JET.OLEDB.4.0;data source=path\\1.mdb";
OleDbConnection con1 = new OleDbConnection(connect1);
con1.Open();
DataTable tables1 = con1.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"TABLE"});
foreach(DataRow row in tables1.Rows)
dropdownList1.items.add(row[2]);
String connect2 ="Provider=Microsoft.JET.OLEDB.4.0;data source=path\\2.mdb";
OleDbConnection con2 = new OleDbConnection(connect2);
con2.Open();
DataTable tables2 = con2.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"TABLE"});
foreach(DataRow row in tables2.Rows)
dropdownList2.items.add(row[2]);
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
hi Parwej
Thanks a lot.There r few errors for ex GetOleDbSchemaTable.Remaining things r fine.thanks once again for your needly help.
|
|
|
|
|
Hi all ,
Please help me i m writing the code in VB6 Plz give me same code in C#.
Open "lpt1" For Output As #1<br />
Print #1, Chr(27) & "@" 'Initialize printer<br />
'Print #1, Chr(27) & "A" & Chr(15) ' set to 10/72"<br />
Print #1, Chr(27) & "M"<br />
Close #1
thanx in advance..
help as a alias.
Be happy and make others happy.Cheer up...........
|
|
|
|
|
System.IO.StreamWriter writer = System.IO.File.CreateText("lpt1");
writer.WriteLine("@");
writer.WriteLine("A" + ((char)15).ToString());
writer.WriteLine("M");
writer.Close();
Not sure about this, didn't test.
Next time write: "How to write to a file in c#", instead of "Give me a code", because people here usually do not like to "give a code"
Greetings - Gajatko
|
|
|
|
|
|
Is there any way to insert objects to a section in the crystal report at runtime?
I can able to add a text object to a section(say section 3) during development time and associate a data table column to that text field. Is there any way to do this at runtime?
Thanks,
Nanda
|
|
|
|
|
you can pass parameters at the time of loading of crystal report.
help as a alias.
Be happy and make others happy.Cheer up...........
|
|
|
|
|
I didn't got. Can you give a sample code?
|
|
|
|
|
if you r pass query(parameters) from the form to show the crystal report directly then i have a code for you that may help you.
<br />
private void AmountDue_Load(object sender, EventArgs e)<br />
{<br />
this.Width = 912;<br />
this.Height = 587;<br />
ParameterFields Fields = new ParameterFields();<br />
ParameterField Field = new ParameterField();<br />
ParameterDiscreteValue DescreateValue = new ParameterDiscreteValue();<br />
OleDbCommand MyCommand = new OleDbCommand();<br />
OleDbDataAdapter MyDa = new OleDbDataAdapter();<br />
DataSet MyDs = new DataSet();<br />
ReportDocument crReportDocument = new ReportDocument(); <br />
<br />
mainObj.s = sAmountDue;<br />
mainObj.choosedata();<br />
string RecordString = "Select housetype,OwnerName,meternumber,DueAmount from Client order by housetype";<br />
mainObj.passconn.Open();<br />
MyCommand.Connection = mainObj.passconn;<br />
MyCommand.CommandText = RecordString;<br />
MyCommand.CommandType = CommandType.Text;<br />
MyDa.SelectCommand = MyCommand;<br />
mainObj.passconn.Close();<br />
MyDa.Fill(MyDs);<br />
string name = "AmountDueCrystalReport";<br />
string rptPath = Application.StartupPath + "\\" + name + ".rpt";<br />
if (!System.IO.File.Exists(rptPath))<br />
{<br />
throw (new Exception("Enable To Locate File:" + rptPath));<br />
}<br />
<br />
crReportDocument.Load(rptPath);<br />
crReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait;<br />
crReportDocument.PrintOptions.PaperSize = PaperSize.PaperA4;<br />
crReportDocument.Refresh();<br />
crReportDocument.SetDataSource(MyDs.Tables[0]);<br />
<br />
Field.ParameterFieldName = "ColnyName";<br />
DescreateValue.Value = sAmountDue.ToString();<br />
Field.CurrentValues.Add(DescreateValue);<br />
Fields.Add(Field);<br />
crystalReportViewer1.ParameterFieldInfo = Fields;<br />
crystalReportViewer1.ShowExportButton = false;<br />
crystalReportViewer1.ShowGroupTreeButton = false;<br />
crystalReportViewer1.DisplayGroupTree = false;<br />
crystalReportViewer1.ShowRefreshButton = false;<br />
crystalReportViewer1.ReportSource = crReportDocument; <br />
}<br />
i m using the same code also you must clear the reportsource(property of crystal repoet viewer) from the page design section.
help as a alias.
Be happy and make others happy.Cheer up...........
|
|
|
|