|
PC17 wrote: but with not!
I assume you meant witg your app NOT.
Did you create project as service?
|
|
|
|
|
Hi,
It works but it doesn't!
I have questions about the Listen method. Does it block at
received = networkStream.Read(data, 0, data.Length);<br />
until data arrives? What happens next, that is, does it loop around and block again waiting for more data?
Alan.
|
|
|
|
|
Timer works in diffrent Thread, as soon Timer.Enabled set to true, it will send event every time an event Ticked and it doesn't matter how occupied is the main thread
|
|
|
|
|
Hi,
The code fragment shows that he is using System.Forms.Timer which raises events on the UI thread.
Alan.
|
|
|
|
|
I Think you are on to something.
Timer time1 = new Timer();
time1.Tick += new EventHandler(myTimer_Tick);
time1.Interval = 1 * 1000;
time1.Enabled = true;
time1.Start();
while (true)
{
}
This above code doesn't fire anything, so i think he needs to create timer in another class, while that class is created in a diffrent thread using System.Threading
|
|
|
|
|
It doesn´t work!
I have tired it with a new server and client and it doesn´t work here is the Server and Client Source code with timer:
http://ul.to/7xbgwn[^]
if by somebody works, please post me!
|
|
|
|
|
Hi,
Finally you post code showing the root cause of the problem. The Listen method is running on a secondary thread and the System.Windows.Forms.Timer is designed to operate on the UI thread only.
You may
1) Wrap the timer manipulation code in a method and use this.Invoke and a method delegate to force the code to run on the UI thread.
OR
2) Change the timer to either System.Threading.Timer or System.Timer.
Option 2 would be the cleaner solution.
Alan.
|
|
|
|
|
I tried the the second solution, but it doesn´t work!
Maybe i habe made something wrong can you send me the code how do you mean!
Please
|
|
|
|
|
Hi,
Your most common response to any suggestion is "it doesn't work" without any backup information.
Please post a relevant code sample with details of the test you performed and the result of the test.
Alan.
|
|
|
|
|
Message Closed
modified 2-Apr-21 5:25am.
|
|
|
|
|
Hi
As you have found, the code is incorrect and will not compile. The error message is telling you that Tick, Interval, Enabled and Start do not exist in the System.Threading.Timer class. It is really up to you to learn how to use the class by reading the documentation.
System.Threading.Timer[^]
Alan.
|
|
|
|
|
|
I think ComponentOne has their own Forum. pleaes Post it here
http://helpcentral.componentone.com/CS/forums/[^]
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
if (FileUpload1.HasFile == true)
{
FileUpload1.SaveAs(Server.MapPath("~/AdminSection/Attachment/"+FileUpload1.FileName.ToString()));
}
hi,
anybody knows, what may be the possibility by which this condition alwz return false.
|
|
|
|
|
did you put it in update panel ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i recently see the code:
lock(obj)
{
...
System.Threading.Monitor.PulseAll(obj);//is it need?
}
i want to konw the sentence is need?
|
|
|
|
|
|
I have create a dynamic menu but problem is that how we give for a page link in clildnodes.
my code is attached in code block-
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class top : System.Web.UI.Page
{
SqlConnection conn;
DataUtility dut = new DataUtility();
protected void Page_Load(object sender, EventArgs e)
{
PopulateMenu();
}
private void PopulateMenu()
{
DataSet ds = GetDataSetForMenu();
Menu menu = new Menu();
menu.MenuItemClick += new MenuEventHandler(menu_MenuItemClick);
foreach (DataRow parentItem in ds.Tables[0].Rows)
{
MenuItem categoryItem = new MenuItem((string)parentItem["Catname"]);
menu.Items.Add(categoryItem);
foreach (DataRow childItem in parentItem.GetChildRows("Children"))
{
MenuItem childrenItem = new MenuItem((string)childItem["Subcatname"]);
categoryItem.ChildItems.Add(childrenItem);
}
}
Panel1.Controls.Add(menu);
Panel1.DataBind();
}
void menu_MenuItemClick(object sender, MenuEventArgs e)
{
string selected = e.Item.Text;
Response.Write(selected);
}
private DataSet GetDataSetForMenu()
{
conn = dut.getConnection();
SqlDataAdapter adCat = new SqlDataAdapter("SELECT tbl_Category.* FROM tbl_Category,tbl_Usercat where tbl_usercat.uid=1 and tbl_Category.sno=tbl_Usercat.catid", conn);
SqlDataAdapter adProd = new SqlDataAdapter("SELECT tbl_SubCategory.* FROM tbl_SubCategory,tbl_UserSubcat where tbl_UserSubcat.UID=1 and tbl_SubCategory.sno=tbl_UserSubcat.SubCatid", conn);
DataSet ds = new DataSet();
adCat.Fill(ds, "tbl_Category");
adProd.Fill(ds, "tbl_SubCategory");
ds.Relations.Add("Children", ds.Tables["tbl_Category"].Columns["sno"], ds.Tables["tbl_SubCategory"].Columns["CatID"]);
return ds;
}
}
so plz help me soon.
thanks
vivek
|
|
|
|
|
Thats the 4th post and i given you a hint what to do.
that needs to be in Foreach loop.
MenuItem subItem = new MenuItem();
subItem.Text = parentItem["Catname"].ToString();
subItem.MenuItemClick += new MenuEventHandler(menu_MenuItemClick);
menu.Items.Add(subItem);
Edit: That is yust a sample. I saw you have 3 foreach. Each MenuItem needs to have click event. Don't worry if it is same method(Function).
|
|
|
|
|
Hi,
I want to import excel data into the database and also update that excel data using asp.net in c#.
I tried import the excel files but sometime the data is ecel file is not read.
Just because there is no single quote at the begining of each record.
How to solve this issue??
|
|
|
|
|
Hi,
Can you explain that how you reading the data from excel file using odbc or using COM objects..
Please put you code sample here.
Hope I can help you..
Be an Eagle, Sky is Yours.
|
|
|
|
|
I have create a dynamic menu but problem is that how we give for a page link in clildnodes.
my code is like that---------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class top : System.Web.UI.Page
{
SqlConnection conn;
DataUtility dut = new DataUtility();
protected void Page_Load(object sender, EventArgs e)
{
PopulateMenu();
}
private void PopulateMenu()
{
DataSet ds = GetDataSetForMenu();
Menu menu = new Menu();
menu.MenuItemClick += new MenuEventHandler(menu_MenuItemClick);
foreach (DataRow parentItem in ds.Tables[0].Rows)
{
MenuItem categoryItem = new MenuItem((string)parentItem["Catname"]);
menu.Items.Add(categoryItem);
foreach (DataRow childItem in parentItem.GetChildRows("Children"))
{
MenuItem childrenItem = new MenuItem((string)childItem["Subcatname"]);
categoryItem.ChildItems.Add(childrenItem);
}
}
Panel1.Controls.Add(menu);
Panel1.DataBind();
}
void menu_MenuItemClick(object sender, MenuEventArgs e)
{
string selected = e.Item.Text;
Response.Write(selected);
}
private DataSet GetDataSetForMenu()
{
conn = dut.getConnection();
SqlDataAdapter adCat = new SqlDataAdapter("SELECT tbl_Category.* FROM tbl_Category,tbl_Usercat where tbl_usercat.uid=1 and tbl_Category.sno=tbl_Usercat.catid", conn);
SqlDataAdapter adProd = new SqlDataAdapter("SELECT tbl_SubCategory.* FROM tbl_SubCategory,tbl_UserSubcat where tbl_UserSubcat.UID=1 and tbl_SubCategory.sno=tbl_UserSubcat.SubCatid", conn);
DataSet ds = new DataSet();
adCat.Fill(ds, "tbl_Category");
adProd.Fill(ds, "tbl_SubCategory");
ds.Relations.Add("Children", ds.Tables["tbl_Category"].Columns["sno"], ds.Tables["tbl_SubCategory"].Columns["CatID"]);
return ds;
}
}
so plz help me soon.
thanks
vivek
|
|
|
|
|
How many times will you create this thread. This is already 3rd time within 24 hours on this forum. Also put your code in code block: <pre></pre>.
For each menu and sub menu add event click. you can assign to same event to same method, and then in event method handle your request
modified on Saturday, August 22, 2009 1:54 AM
|
|
|
|
|
Hi I want source code c++ language modify to xml in c#. I want example. please help me thank.
|
|
|
|
|
I do not understand your question, please explain
|
|
|
|