|
you can filter the files with using the overloaded version of the GetFiles(string path,string searchPattern)
it would be somewhat like this for zip files
<code>
string[] files=System.IO.Directory.GetFiles(path, "*.zip");
</code>
good luck
|
|
|
|
|
Dynamically created user control with its parent control
Hi..
how could i access the user control's objects from its parent control.
i've created a control which includes a listbox and a another usercontrol(CHILD1)..say control CHILD2.
now m dynamically adding CHILD2 control within a control say Parent1. now i wants to access the values entered within the CHILD2..which provides me the values of the listbox and the CHILD1's control.
but the debugger shows that the listbox is no more exist in the class of CHILD2 itself...
is there any way to get the values from all the control ... in the parent control..
thanks in advance
Bhuwanesh Joshi
|
|
|
|
|
you can try
foreach(CHILD2 cl in Parent1.Controls)
{
cl.properties of user control;
}
rahul
|
|
|
|
|
Hi,
i have a little quiestion, about deserializing a custom type...I want to deserialized this custom type but actually i dont know it. What i mean is for example i have a type called TypeA - i serialized it. But when i want to deserialized i dont know what type i have at the xml file(for xml serialization). I want to find it out.
Is there way to find what type i have?
|
|
|
|
|
One option would be to serialize as part of the object the Type's FullName.
this.GetType().FullName
This wont help you on "automatically" deserializing that object, but you could directly interrogate the Xml to determine what the type was of the serialized object.
|
|
|
|
|
Sorry, I am a beginer, is there any article to understand serialization.
Thanks,
h.
|
|
|
|
|
Yes there is. Search on codeproject
|
|
|
|
|
The only solution I know is to store the type during serialization. When deserializing, first deserialize the type description and deserialize the object afterwards, using a switch statement for the type to deserialize.
It took me a lot of time to find out how to do it. I will write an article about this subject for codeproject. I think it may be ready somewhere next week.
Rudolf Heijink
|
|
|
|
|
Thank you! It's really hard work, i couldnt found any topics about this problem. It's currious for me to see the way you do this, so i'll wait next week if you don't mind send me an email to pa_tcho7@yahoo.com with the link of the topic.
Best Regards
|
|
|
|
|
I want the date format to be in this way like 15-jun-2005 using c# dot net
Regards,
Magi
|
|
|
|
|
Magh_M wrote: I want the date format to be in this way like 15-jun-2005 using c# dot net
Jesus, I say to my 5 year old niece "I want's never get". I'd expect someone even old enough to ask a programming question would have the decency to say please if they're asking for help!
myDate.ToString("dd-MMM-yyyy");
You're welcome!
|
|
|
|
|
you can try
DateTime dts = DateTime.Now;
MessageBox.Show(dts.ToString("dd-MMM-yyyy"));
rahul
|
|
|
|
|
You forgot to put URGENT!!!!!! on the end of your demand.
I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days
|
|
|
|
|
The upload button's click event should activate the conversion of excel to ADO.
protected void butUpload_Click(object sender, EventArgs e)
{
private void BindData()
{
DataSet dsLoginSourceGrid = GetLoginDataSet();
GridView1.DataSource = dsLoginSourceGrid.Tables[0].DefaultView;
GridView1.DataBind();
}
private string GetConnectionString()
{
string strConnectionString = ConfigurationManager.ConnectionStrings["constr"].ToString();
return strConnectionString;
}
}
|
|
|
|
|
you can define the method out side and can call from another method.
rahul
|
|
|
|
|
Hi Rahul,
Can you please give me an example: Based on my code??
|
|
|
|
|
Why would you want to define either of those methods inside another method, rather than just call the method in the usual way?
Do you have any experience in programming, or is this one of your first attempts? If it is I strongly advise you pick up a book on C# (or whatever chosen language) and work through the basics!
|
|
|
|
|
The solution is to learn the basics about programming and the C# syntax. The simple answer is:<blockqoute>You can't define methods nested inside other methods like that.You define all of your methods at the same level and then call them from one another:
protected void butUpload_Click(object sender, EventArgs e)
{
BindData();
string connectionString = GetConnectionString();
}
private void BindData()
{
DataSet dsLoginSourceGrid = GetLoginDataSet();
GridView1.DataSource = dsLoginSourceGrid.Tables[0].DefaultView;
GridView1.DataBind();
}
private string GetConnectionString()
{
string strConnectionString = ConfigurationManager.ConnectionStrings["constr"].ToString();
return strConnectionString;
}
Also, it helps if you put your code samples in <pre> tags so they are readable.
|
|
|
|
|
hi all
i have an xml
i am able to change into data table
and insert into database also...
StringReader xmlsr3 = new StringReader(region);
dset3.ReadXml(xmlsr3, XmlReadMode.IgnoreSchema);
OleDbDataAdapter da3 = new OleDbDataAdapter("select * from drregion", m_Conn);
OleDbCommandBuilder cb3 = new OleDbCommandBuilder(da3);
da3.Update(dtab3); dtab3 = dset3.Tables[0];
like this it gets updated
now the problem is when xml string has a keywords (of databases)
while updating into database that is in the last statement
there is an error saying insert into syntax error
i need to change the
ex: keyfield-desc
to [desc] (i could nt do it in xml ) there was another error if i do that
how can i do this
or is there any other way....
|
|
|
|
|
How to test wheather the content is null or not?
byte[] filecontent
if(filecontent==null)
is it right?
pls give ASAP
|
|
|
|
|
Hello,
jayarajmrj wrote: How to test wheather the content is null or not?
byte[] filecontent
if(filecontent==null)
is it right?
If you mean, that there was never done an instanciation:
filecontent = new byte[x];
The answere is, Yes!
If you mean that after the instanciation is done, there was never an assignment to the bytes:
filecontent[0] = ???;
.
.
.
filecontent[x] = ???;
The answere is, No!
jayarajmrj wrote: pls give ASAP
Please, please, please, don't do that again.
It is very rude and will make people angry!
All the best,
Martin
|
|
|
|
|
Please help out in following code snippet:
For the first time it gives prompt while XmlSchema.Read(). Second time schema_collection_object is not null and soes not enter into the below code snippet and works perfectly.
Please help............
XmlSchemaCollection schema_collection_object;
if (schema_collection_object==null)
{
schema_collection_object=new XmlSchemaCollection();
XmlTextReader xmlFile=new XmlTextReader(path);
//path contains the path of the .xsd file
m_ifschema=XmlSchema.Read(xmlFile,new ValidationEventHandler(ValidationCallBack));
//*******error is genarated in the above statement
m_ifSchema.Compile(newValidationEventHandler(ValidationCallBack));
schema_collection_object.Add(m_ifSchema);
}
Hemendra Vyas
|
|
|
|
|
string strPath = @"D:\XML Tutorial(Basics).doc";
string strFileName = strPath.Substring(strPath.LastIndexOf("\\") + 1);
Here it works fine to separate the filename.
Apart from "LastIndexOf", Is there any method to split the filename from the path.
pls give the solution ASAP
|
|
|
|
|
Hi,
Use the following:
string filename=System.IO.Path.GetFileName("YourFilePath");
Naresh Patel
|
|
|
|
|
Hello,
to split a string, you would use the:
String.Split[^] method.
Dealing with filename and pathes you could use the fancy features of System.IO.Path[^] namespace!
In your case, the GetFileName[^] method will do what you need.
string strPath = @"D:\XML Tutorial(Basics).doc";
string strFileName = System.IO.Path.GetFileName(strPath ); /will return: 'XML Tutorial(Basics).doc'
Hope it helps!
All the best,
Martin
|
|
|
|