|
Havent tried to run it as a normal application yet. Will do that later.
The good old trick of constant output is what I've been trying. Just before the call to ServiceBase.Run(servicesToRun); I'm callin EventLog.WriteEvent() and the first thing that is done in the OnStart()-handler is to write another entry in the event log.. That second entry never appears in the log however... But just to be sure, I will try your example with letting the application interact with the desktop.
Using remote debugging reveals tow threads, one without a traceable stack and one thread being stuck on the ServiceBase.Run(servicesToRun)-call.
|
|
|
|
|
Hello All,
Iam a new to this forum.I want some help.
Iam having an .aspx page in that iam having many listbox control.Selection mode is single.Iam binding data to these list box control from the data base while page loading.This is fine no problem.Now i want to store the selected values in to another table on a button click event.but iam getting selected itmes as null.
Please help on this.
i want to join this group
|
|
|
|
|
add the following framework base class
Microsoft.Visual basic.Compatibility.vb6
and use the functions
Support.GetItemData()
Support.SetItemData()
Do u know something the solution about the problem i mentioned just below ur query
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
i want to show the percentage of the records in pie charts and bar charts using the crystal reports.Can somebody please provide any useful link.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Hi,
As per my knowledge all the 7 blocks in the Microsoft Enterprise Library(Pattern & Practices) require atleast a configuration(.config) file.
But while developing a .dll i.e an assembly without using a .config file can I use Enterprise Library. if not for all then for logging or exception handling referencing the dlls from the enterprise Library.....
Required an expert opinion...
Thanks
Sangram
(A battle with self)
Life is simple, we are the ones makes the living difficult
|
|
|
|
|
Would someone please give me a good book I can learn C# 2005 from? I am not new to programming, but kind of new to C#.
Thanks.
|
|
|
|
|
|
Sams Teach Yourself Visual Studio .NET 2003 in 21 days[^]
Their may be a more up to date one, but this is the one that I use.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I have these line of codes :
try
{
string fromDir = file.Substring(0, file.LastIndexOf("\\"));
System.IO.Directory.SetCurrentDirectory(fromDir);
if (!File.Exists(fileToZip))
{
throw new FileNotFoundException("The specified file " + fileToZip + " could not be found. Zipping aborderd");
}
FileStream StreamToZip = new FileStream(fileToZip, FileMode.Open, FileAccess.ReadWrite);
FileStream ZipFile = File.Create(zippedFile);
ZipOutputStream ZipStream = new ZipOutputStream(ZipFile);
ZipEntry ZipEntry = new ZipEntry(fileToZip.Substring(fileToZip.LastIndexOf("\\") + 1));
ZipStream.PutNextEntry(ZipEntry);
ZipStream.SetLevel(CompressionLevel);
if (password != null && !password.Equals(string.Empty))
ZipStream.Password = password;
byte[] buffer = new byte[BlockSize];
System.Int32 size = StreamToZip.Read(buffer, 0, buffer.Length);
ZipStream.Write(buffer, 0, size);
try
{
while (size < StreamToZip.Length)
{
int sizeRead = StreamToZip.Read(buffer, 0, buffer.Length);
ZipStream.Write(buffer, 0, sizeRead);
size += sizeRead;
}
}
catch (System.Exception ex)
{
throw ex;
}
ZipStream.Finish();
ZipStream.Close();
StreamToZip.Close();
}
catch (Exception ex)
{
throw ex;
}
The error occurs on this line
FileStream ZipFile = File.Create(zippedFile);
how am i going to resolve it? thanks
|
|
|
|
|
The secret is in reading the excepion text :P
toink toink wrote: The process cannot access the file because it is being used by another process.
Which means someone already has a lock on that file. Possibly you.
There are a few tools around which allow you to investigate the locks on a file. Theres a few at SysInternals[^] but personally I like Unlocker[^].
|
|
|
|
|
hi there,
i have a problem that is when i write connection string of sql like this
dataConnection.ConnectionString = "Data Source= MATO\\SQLEXPRESS; Integrated Security=true; Initial Catalog=ABCdatabase;";
then its works
but when i wrote something like this
string connection = File.ReadAllText(@"C:\Documents and Settings\Quarantined\Desktop\connection.txt");
dataConnection.ConnectionString = connection;
its giving error "Instance Failed"
the connection.txt file contains the same line which is written above for connectionstring
any one know the solution ../?
Becoming Programmer...
|
|
|
|
|
I guess. maybe. there are some whitespace or newline in that textfile..
Why do you wanna store the connection string in textfile? I would suggest you to store the connectionstring in either App.Config or web.config.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I feel really stupid right about now.
I have had someone explain it to me but I don't understand. I have a checkedlistbox which i want to allow multple skills to be matched against a person. I have dataadapters and sql server database. I have an employees with employeeID table and a technicalskills table with techskilsID . I was told to create another table with tchskillsid and empid so I can save multiple selections in there. My code is all over the place. I'm sure no one will want to help me with this one which is understandable, but I don't know where to turn to. Apparently I have to get the ID's from the selected text by using select statement and then insert into the new employeeskillset table and match against empid in the employees table and store the record in there against the persons name. confused yet? I am.
The following returns error:
Error 5 No overload for 'empSaveButton2_Click' matches delegate 'System.EventHandler'
My CODE
private void empSaveButton2_Click(object sender, DataSet dataset, string connectionString, string queryString, EventArgs e)
{
myConnection = new SqlConnection("server = ADMMSAS7;database=Dev_RST;Trusted_Connection=yes");
myConnection.Open();
// foreach (int indexChecked in techSkillsCheckListBox2.CheckedIndices)
// {
for (int x = 0; x <= techSkillsCheckListBox2.CheckedItems.Count - 1; x++)
// {
// If so, loop through all checked items and print results.
{
DataSet ds = new DataSet();
string sql = "Select t.TechnicalSkillsID from TechnicalSkills t where t.TechnicalSkillsID = '" + techSkillsCheckListBox2.CheckedItems[x] + "')";
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(sql, myConnection);
adapter.Fill(ds, "TechSkillSet");
DataTable dt = ds.Tables["TechSkillSet"];
foreach (DataRow row in dt.Rows)
{
foreach (DataColumn col in dt.Columns)
sql = "Insert into TechSkillSet (EmployeeID,TechnicalSkillsID) values (" + techSkillsCheckListBox2.CheckedItems[x] + " , " + FirstnameText.Text.ToString() + " , " + Lastnametext.Text.ToString() + ")";
}
{
|
|
|
|
|
Hi , im developing an application its all working fine untill recentrly i got an error:
"error creating window handle" ,
so i was googling on the subject and i found out it happens when youre application is using 2 many controls
and thats indeed my case , so the solution was to replace the controls by drawing directly to the graphics of the parent control instead of making new child controls , for example if i have a panel , and i got like 1000 labels inside that panel , the idea is to do something like:
Graphics g = Graphics.FromHwnd(mypanel.Handle);
g.drawString(string,font....);
instead of adding 1000 labels to the panel.
ok so here is the problem i am trying to adopt this technique but i found out that in cases when i minimize
the window and then resize it back i see that all my drawings are gone , or when the panel uses the autscroll
when it appends the scroll bars same thing happens
all the drawings are gone ,
so my question is, is there any way to make these drawings stay permenently on the control , or i will have to make many eventhandlers and repaint evrything evrytime something happens....
or is there any other solution for this kind of problem thanks.
Net
|
|
|
|
|
this problem comes when u r not disposing objects properly.so
dispose the objects properly and try to repaint again.
rahul
|
|
|
|
|
sorry for the late reply and thanks for replying my question.
I didnt understand what you mean by "u r not disposing objects properly",
Did you reffer to the part where: when i draw on the control all my drawings are gone?
if so, how can i dispose the object properly so it wont happen , could you be a bit more specific? ,
thanks alot.
Net
|
|
|
|
|
This was a question on a students exam:
Shown was a static void main, and a second class, titled Punta.
namespace Test
{
class Test
{
static void Main(string[] args)
{
Punta punt = new Punta();
double bla = punt.Search();
}
}
class Punta
{
double Search()
{
return 5.0; //assume we calculated something here and found it
}
}
}
Question was: Is this code executable? (Exam) Answer: No
Q for codeproject: CAN you compile, link and execute wrong code like this? Or is the only way to do so by supressing warnings and errors from the compiler?
Question 2 was: If it's not executable (which was assumed you've noticed), the question was: Why?
And, how can you fix that, without changing the code of Punta-class.
The expected answer for the teacher was: An interface.
Followed by lines of code to make it accessible.
BUT... it did say, "you may NOT change the code of the class 'Punta'". But how is that some people say: If you use an interface, you're actually modifying the class. And some say, you aren't.
Which is it?
-- modified at 23:04 Wednesday 5th September, 2007
|
|
|
|
|
Unless something was lost in translation, and certainly some code was, the problem is that
'Punta.Search()' is inaccessible due to its protection level
which can't be fixed without changing class Punta. An interface won't fix the situation as posted.
|
|
|
|
|
Agree, either you add a public or if you use an interface and use it explicit you have to add the interface name plus a . to "Search"
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
... and you'd still have to add public to the method.
|
|
|
|
|
not when you explicitly implement it, then no modifier is allowed.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
"double void" ? I want one of those!
|
|
|
|
|
mizitras wrote: Question was: Is this code executable? (Exam) Answer: No
Correct, it won't even compile.
mizitras wrote: Q for codeproject: CAN you compile, link and execute wrong code like this? Or is the only way to do so by supressing warnings and errors from the compiler?
Question 2 was: If it's not executable (which was assumed you've noticed), the question was: Why?
You can suppress warnings, not the errors. No, you still won't be able to compile this thing since the "double void Search()" will confuse the compiler. It won't make any assumptions about what you really mean here. You cannot have two return types.
mizitras wrote: And, how can you fix that, without changing the code of Punta-class.
You can't. The Punta class MUST be changed to specify a single return type for the Search method. Also, since the default protection level is private, you must specify the Search method as public or internal for it to be seen outside the Punta class.
An interface will NOT fix this problem since interfaces do not modify a class. Interfaces specify the methods that an implementing class must define. The class must still be modified to tell it which interface it's implementing. Either way, the Punta class must be modified in order for it to be fixed.
-- modified at 12:04 Tuesday 4th September, 2007
|
|
|
|
|
Aah dang, I accidentally typed "double void" instead of just double and void in the Search(void)
Now I've posted the wrong question
|
|
|
|
|
I would like to create a window with round edges with C#. In window Form there is a variable Region variable to set for such purposes.
First I can create a GraphicsPath with CreateGraphicsPath funcation.
public static GraphicsPath CreateGraphicsPath(Rectangle rect, float radius)
{
GraphicsPath gp = new GraphicsPath();
gp.AddLine(rect.Left + radius, rect.Top, rect.Left + rect.Width - radius, rect.Top);
gp.AddArc(rect.Right - radius, rect.Top, radius, radius, 270, 90);
gp.AddLine(rect.Right, rect.Top + radius, rect.Right, rect.Bottom - radius);
gp.AddArc(rect.Right - radius, rect.Bottom - radius, radius, radius, 0, 90);
gp.AddLine(rect.Right - radius, rect.Bottom, rect.Left + radius, rect.Bottom);
gp.AddArc(rect.Left, rect.Bottom - radius, radius, radius, 90, 90);
gp.AddLine(rect.Left, rect.Bottom - radius, rect.Left, rect.Top + radius);
gp.AddArc(rect.Left, rect.Top, radius, radius, 180, 90);
gp.CloseFigure();
return gp;
}
After that set
GraphicsPath gp = CreateGraphicsPath(ClientRectangle, radius);
this.Region = new Region(gp);
gp.Dispose();
After some time I would like to increase the size of window, which I am unable to do so. I tried creating new path and set to this.Region, but did not work. The window is not round any more. Any clue?
Thanks in advance if someone put light on it. If someone like to have code how I am increasing the size I can send the code as well.
agha.khan@hotmail.com
Agha Khan
|
|
|
|
|