My solution in Visual Studio consists of several projects.
1. One DLL project which holds the business code
2. One project that is the service - reference is made to previous project
3. One Console project used to force a execution without the service - reference is made to first project (DLL project)
4. Setup deployment project - reference is made to the service
In C# web application Requirement is when using admin panel admin inserts categoy,product etc then update also his store database on Ebay i hv integrated site with Ebay store db and updating that too. But Saving data takes time and Admin gets logout automatically I think default session time is up Plz help how to handle this
Not necessary that Session has timed out. It could be databse transaction timeout too. Or the established Connection timeout. You need to debug and find where the bottle neck is and increase the time accordingly.
Reading and writing values in the registry is the same regardless of the format. In the case of REG_BINARY the returned object is of type byte. The following code would convert that to a string. You would reverse the process to write it back.
RegistryKey regKey3 = Registry.CurrentUser;
RegistryKey regSub3 = regKey3.OpenSubKey("Software or whatever");
byte ans = (byte)regSub3.GetValue("Value I need");
string sString = System.Text.Encoding.ASCII.GetString(ans);
string  sArray = sString.Split('\0');
sString = "";
foreach (string s in sArray)
sString += s;
Now sString should have your string from the reg_binary ready for processing.
private int RandomNumber(int min, int max)
Random random = new Random();
return random.Next(min, max);
and i am clalling this method in for loop. my expectation is for every iteration in the loop i am expecting some new random number. code for that is like below:
Don't instantiate a new Random every time. Treat random as a singleton.
Random will (by design) give you the same sequence of numbers every time unless you start with a different seed. Right now you are getting the first number of the sequence every time.
The opinions expressed in this post are not necessarily those of the author, especially if you find them impolite, inaccurate or inflammatory.
The default constructor for the Random class uses the system clock to seed the random number generator. Your code is running fast enough that the system clock has not changed between calls to the constructor, resulting in the same random numbers being generated each iteration. See the MSDN documentation for the Random constructor[^] for more clarification and a good example.
it is very easy to detect if someone work with mouse move event of picturebox. but i want to detect mouse over picturebox in mouse move event of the form so first i did set the keypreview property of form to true and then i wrote the code in mouse move event of form.
so my code is ---
private void Form1_MouseMove(object sender, MouseEventArgs e)
if ((X >= pic.Left && X <= pic.Left + pic.Width) && (Y >= pic.Top && Y <= pic.Top + pic.Height))
lblMsg.Text = "Mouse over picturebox";
lblMsg.Text = "";
this code is not working. where i am making the mistake. please rectify me.