|
Hi Elizma,
I think first you need to make some test application in window services with timer. Two many article posted on web you can go through via google or you can find below link:
http://www.aspfree.com/c/a/C-Sharp/Timer-Objects-in-Windows-Services-with-C-sharp-dot-NET/
After that if you have any problem then you can discuss with us.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
Thanks for the immediate valuable suggestions for all my posts....
I have a problem in databinding with datagridview.
mygridview.datasource=ds.Tables[0].DefaultView;
At this particular statement we get an error saying
" cross thread operation not valid; control mygridview accessed from a thread other than the thread it was created on."
Please suggest us...
Regards,
Priya
|
|
|
|
|
An article discussed the all problems. Go through below link:
http://www.codeproject.com/vb/net/AccessControlFromThread.asp
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
iet2000 wrote: mygridview.datasource=ds.Tables[0].DefaultView;
why don`t you use
mygridview.datasource= ds;
******************************
I just want to
know everything
|
|
|
|
|
Hi guys.
I am struggling in one point whether the values in an xml document can be converted in to a Generic List<t>. ie. when i will read an xml document, it will return a List<t>.I am converting the xml to a Generic List<t> because i have go through 3 tier architecture.
If possible please give me some Urls(sites) where i can get some idea.
smishra
|
|
|
|
|
Why do you need a list for 3 tier architecture? This is by no means a requirement of good n-tier design.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello everyone,
With a C# made software, I create an Excel file with many sheets. Everything
goes well until I tried to remove PageBreaks.
I can add them but I can't delete them so I still have the automatic one
appearing there ...
I tried a lot of things such as:
Range AutoVPageBreaks=ExcelWorksheet1.VPagesBreaks[1].Location;<br />
AutoVPageBreaks.PageBreaks=XlPageBreaks.XlPageBreakNone;
or
VPageBreak VPB1= ExcelWorksheet1.VPagesBreaks[1];<br />
VPB1.Delete();
--> This one raised an error
I also tried to add before ResetPageBreaks() or DisplayPageBreaks=false but
nothing worked ... I still have the automatic pagebreaks ...
Does someone know howw to remove those pagebreaks? Do I need to set the
sheet to printpreview? If so, how? (I tried but that raised an error)
I hope you can help me.
Thank you.
|
|
|
|
|
My ListBox Contents are in the form
index. itemName
1. Jack
2. Jane
3. Joe
4. Bill
5. Tim
6. Sid
On removing say Jane I need to get the index of others in proper numerical order. Now ListBox Control only allows me access to the currently selectedItem via its selectedItem property but I need access to all the Items so that I can change them...
Any Advice...
Thanks
Please excuse if this is a very basic question. I'm pretty new to C#.
After Removal the above should become
1. Jack
2. Joe
3. Bill
4. tim
5. Sid
|
|
|
|
|
If you iterate through the Items collection, you get the zero based index of the item.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes I can do that as
IEnumerator enm = this.list.Items.GetEnumerator();
int i = 0;
//Get to The Desired Location
for(i = 0; i < index; i ++ )
{
enm.MoveNext();
}
//Here I can Get Individual Items
for(i = index; i < list.Items.Count; i ++)
{
String entry = enm.Current.ToString();
String newData = doSomething(entry);
// Now Here I Need to Set the Changed Data to ith Position in the List
// cannot Do enm.Current = newData as Current is a readonly Property of IEnumerator
}
Any More Advice...
|
|
|
|
|
I'm sorry, but I'm not sure what you are trying to achieve here. This has gone beyond the scope of your original query. Perhaps you could elaborate a bit.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Sorry about confusing anybody. Here is what I want
My Playlist is displayed in ListBox named list
with contents
1. SongABc
2. Song Dev
3. Vid34
4. Clip5
5. ABC and so on
I need to delete an item from that
for that I'm doing
this.list.Items.RemoveAt(index);
Now I need to update the IndexNumber of each entry in the Playlist so that after deleting "Vid34"
My list shows
1. SongABc
2. Song Dev
3. Clip5
4. ABC and so on
I can READ ALL items of list as
IEnumerator enm = this.list.Items.GetEnumerator();
int i = 0;
for(i = 0; i < index; i ++ )
enm.MoveNext();
//Now I'm at the place where I Delete the Entry
//all the Following Items need to update their Numerical Index Decremented by one
for(i = index; i < list.Items.Count; i ++)
{
String entry = enm.Current.ToString();
String newVal = getNewVal(entry); // Strip Index Value so that "4. Clip5 becomes just Clip5"
//Here I need to set the Current Entry with new Val something like
this.list.itemAt(i) = newVal; // But no such method exists
neither can I do
enm.Current = newVal; // Because it is a readonly property
}
I can clear my playlist and readd everything but that would be waste of resources
|
|
|
|
|
Aah. I see what you're getting at. Well, the simple way to do it would be to use list.Items[i] = newVal; in the loop. You can simplify the logic quite a lot:
for (int i = 0; i < list.Items.Count; i++)
{
string entry = enm.Current.ToString();
list.Items[i] = getNewVal(entry);
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks Man. You Saved Me...
After reading your last post I'm looking like an idiot.
well I'm new to C#
Thanks...
|
|
|
|
|
Sukhjinder_K wrote: After reading your last post I'm looking like an idiot.
Nope, not at all. Don't put yourself down - at least you had a go before posting. There are too many who would just have asked without trying anything themself.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yup this is how we All Evolve by Being a Community...
All the Best..
|
|
|
|
|
Use the Items collection of your ListBox to modify the contents of the list.
Paul
|
|
|
|
|
Hi,
there is a different and better way to achieve a numbered list: ListBox (and ComboBox) support
"OwnerDraw" mode, which means you paint the items yourself in any way you like, instead
of their string value being shown as is. So what you could do is add a DrawItem handler
that does a Graphics.DrawString(itemIndex.ToString()+". "+item.ToString());
Doing this will automatically show the text with its number, whatever happens to the list.
You would have to get the itemIndex from DrawItemEventArgs.Index, and item from
myListBox.Items[itemIndex].
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
am trying to develop one aplication to read a particular node in an xml file. but somewhere i goes wrong and not working.......
plz help me to find out the error.....
In the following xml file i want to find out the last name.
This is the xml
<?xml version="1.0" encoding="UTF-8" ?>
<family>
<name gender="male">
<firstname>Tom</firstname>
<lastname>Smith</lastname>
</name>
</family>
and the code is --------
FileStream fs = new FileStream("D:\\Myfolder\\gender.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
xmldoc.Load(fs);
XmlNodeList xmlnode = xmldoc.GetElementsByTagName("name");
for (int a = 0; a < xmlnode.Count; a++)
{
if (xmlnode[a].Attributes[0].Value == "gender")
// match your attributes
{ //codes
lblcnt.Text=a.ToString();
String firstNameValue = reader.ReadElementString("gender");
Lblmsg.Text=" FirstName: "+firstNameValue;
}
I tried this one also=======
XmlTextReader reader = new XmlTextReader ("D:\\Myfolder\\gender.xml");
XmlDocument xmldoc = new XmlDocument();
XmlTextReader reader = new XmlTextReader ("C:\\gender.xml");
try
{
while (!reader.EOF)
{
reader.Read();
if(reader.IsStartElement() )
{
reader.Read();
xmldoc.SelectSingleNode("family/name/firstname");
XmlNode xmlnode1=xmldoc.GetElementsByTagName("firstname");
String firstNameValue = reader.ReadElementString("firstname");
xmldoc.SelectSingleNode("lastname");
String lastNameValue = reader.ReadElementString("lastname");
Lblmsg.Text=" FirstName: "+firstNameValue + " LastName: " + lastNameValue;
}
}
reader.Close();
}
catch (Exception err )
{
Lblmsg.Text="Error: " + err.ToString();
}
-- modified at 23:25 Wednesday 12th September, 2007
|
|
|
|
|
This is a disaster
princymg wrote: xmldoc.SelectSingleNode("family/name/firstname");
This would work if
a - you loaded your xml into xmldoc, and
b - you grabbed the return value from the call
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 think this will help U
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("gender.xml"));
DataTable dt = ds.Tables["family"];
DataRow dr;
for (int i = 0; dt.Rows.Count > i; i++)
{
dr = dt.Rows[i];
String firstNameValue = dr["firstname"].ToString();
String lastNameValue =dr["lastname"].ToString();
Lblmsg.Text=" FirstName: "+firstNameValue + " LastName: " + lastNameValue;
}
Jintal Patel
|
|
|
|
|
i think XQuery will help u out
XQuery is to XML what SQL is to database tables.
http://www.w3schools.com/xquery/xquery_intro.asp
|
|
|
|
|
I got the code......
string str;
XmlTextReader reader = new XmlTextReader ("D:\\Foldername\\tx1.xml");
try
{
while (reader.Read())
{
if(reader.IsStartElement() )
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "jid")
{
str=reader.ReadString();
//Lblmsg.Text="Article Title is : "+ reader.Name+ " : "+reader.ReadString();
Lblmsg.Text="Article Title is : "+ reader.Name+ " : "+str;
lblcnt.Text=str;
}
}
}
reader.Close();
}
catch (Exception err )
{
Lblmsg.Text="Error: " + err.ToString();
}
Thanks for the help....................
|
|
|
|
|
Dudez,
Is there a way to save the username and password when user login.
Example:
I will access computer name \\ROBO then username and password form pop up.Think on computer neighborhood. When that user input his/her username and password. It will save on temporary file. Is it possible? How to do that? Much better if you can give a link or an existing application that can be downloaded (3rd party).
Thanks in advance,
jeof
******************************
I just want to
know everything
|
|
|
|
|
You can store any info you like, whereever you like. Storing passwords is obviously sensitive, however.
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 )
|
|
|
|