|
Sounds like the user that runs your service does not have permissions to access your database.
Goto "Settings->Control Panel->Administrative Tools->Services". Open the properties for your service, then look at the "Log On" tab-page. This will tell you the user that is running your service. Then make sure that that user has permissions to log into your database and to access the file-system folders that you are watching.
|
|
|
|
|
There are no restrictions on a service updating an SQL database. The problem is probably caused by you using a Trusted Connection in your connection string instead of supplying an actual username and password to login to the SQL Server. Any normal service, by default, uses the LocalSystem account, which isn't going to be trusted by a remote SQL Server.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a custom control in a form and I want it to catch the key I press, so I implement the "KeyDown" event, its ok but the event does not fire when I press TAB, Up, Down... (the keys that is used internal to change the tab index of control inside the form).
How can I disable it and handle those special keys?
Thank you for your help!
|
|
|
|
|
Hello,
When you use te KeyDown event the member 'KeyData' is what you are looking for.
if(e.KeyData == Keys.Tab)
{
e.Handled = true;
}
All the best,
Martin
|
|
|
|
|
But it is not go to the KeyDown method at all when you press Tab, we can not check it.
|
|
|
|
|
Hi,
It may sound weird but if you want to trap the TAB key for a control
then you should check it in the KeyUp event of the next control(Next Control : control is getting focuse On pressing Tab)
|
|
|
|
|
Hi,
AFAIK you should override IsInputKey().
|
|
|
|
|
Hello Luc,
I also tried it, because I'm currious, but sadly it doesn't jump in the overriden method.
Tried it in the MainForm and in an UserControl.
protected override bool IsInputKey(Keys keyData)
{
return base.IsInputKey (keyData);
}
I read the msdn infos and know how it should work, but now I'm confused?
Any hints?
All the best and mercy,
Marin
-- modified at 11:45 Wednesday 28th February, 2007
Ok, just found out how to use it in an inherit TextBox for example:
protected override bool IsInputKey( System.Windows.Forms.Keys keyData )
{
switch ( keyData)
{
case Keys.Tab:
return true;
default:
return base.IsInputKey(keyData);
}
}
But it's not working on an UserControl or Form.
All the best,
Martin
|
|
|
|
|
Hi Martin,
Martin# wrote: But it's not working on an UserControl or Form.
What do you mean by this ? Is your IsInputKey() not called at all ? (for regular chars,
for TAB, arrows...) ? or is its return value simply ignored ?
And for which .NET version is this observation ?
I am using IsInputKey() on Panels only (both 1.1 and 2.0), no problem there.
|
|
|
|
|
Luc Pattyn wrote: s your IsInputKey() not called at all ? (for regular chars,
for TAB, arrows...) ?
Yes, in all points!
-- modified at 14:12 Wednesday February, 2007
I'm just rereading what I was answering before.
I think it was not clear.
What I meant, was that it is never called!
-- modified at 5:09 Thursday 1st March, 2007
I'm only using 1.1
|
|
|
|
|
I tried it too,
I override the IsInputKey method for the FORM, and the method was not called.
According to MSDN, it should be called.....
|
|
|
|
|
I have a weird problem. I have a VERY simple application that has been associated with a extension of .tix on my computer. Basically I want it when I open this .tix file, it sends the contents of the file thru the serial port. All the application has to do is send the data, and then close so there is no need for a form or anything else. What I have done is created a simple desktop application and in the Program.cs file I changed it to the following code. Just for testing I have hard coded in the contents of the .tix file into the variable TicketText. In Visual Studio when I run the application in debug mode I get a MessageBox that says "Ticket Printed-" and the application closes. The information is sent correctly thru the Serial Port as it should. When I load a .tix file then nothing is sent to the serial port. What is the difference?
<br />
static void Main(string[] args)<br />
{<br />
string TicketFileName = ""; <br />
try<br />
{<br />
TicketFileName = args[0].ToString();<br />
}<br />
catch { }<br />
<br />
SerialPort sp = new SerialPort();<br />
<br />
string TicketText = "Brad Presents BX3";<br />
<br />
sp.PortName = "COM4";<br />
sp.BaudRate = 1200;<br />
sp.Parity = Parity.None;<br />
sp.DataBits = 8;<br />
<br />
sp.Open();<br />
sp.WriteLine(TicketText);<br />
sp.Close();<br />
<br />
MessageBox.Show("Ticket Printed-" + TicketFileName.ToString());<br />
<br />
Application.Exit();<br />
}<br />
|
|
|
|
|
Brad Wick wrote: When I load a .tix file then nothing is sent to the serial port. What is the difference?
Hard or even impossible to say without seeing the code that loads the file.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
it is in general a bad idea to ignore exceptions, which is what you do when specifying
an empty catch block. I suggest you put all your code in one try block, and
show the full exception.ToString() text in a messagebox when things go wrong (i.e.
inside the one and only catch block).
That will probably lead you straight to the heart of your problem.
|
|
|
|
|
My best guess at this point is that the call to Application.Exit() is causing a problem in release mode. If the application is exiting in any case, this call is unnecessary.
Phil
|
|
|
|
|
Using DirectX.Capture I lately found out that there is a problem in Lip movement and voice synchronization, i.e. when I apply Video Compression and without applying audio compression, say for example Microsoft Video 1, I found out that the voice and the lip movement does not match, sometime the voice/sound came out after the lip movement or vice-versa. What is the problem with these and how do I solve this problem. I will be very happy to get answer for this query.
Thanks in advance.
Suan Ngaihte.
|
|
|
|
|
1.I am wondering what is the need for attribute
if I have mechanisem calles interface to show behavior of classes?
2 . I saw some application that adding option in EXCEL FILE menu
how can I do this? (like after SAVE to add another option)
thanks
|
|
|
|
|
groundzero111 wrote: 1.I am wondering what is the need for attribute
if I have mechanisem calles interface to show behavior of classes?
Attributes are used for associating information with code elements. You can add attributes to most any code element, like types, methods, properties, classes.
Interfaces are used for defining a set of properties and methods. An interface is implemented by inheriting it, so it can only be done by classes or structs. An interface is similar to an abstract base class.
---
single minded; short sighted; long gone;
|
|
|
|
|
You are right about general use of attributes vs interfaces.
But then you have interfaces like INamingContainer[^]. It could as well be attribute. I wonder what's the reason why INamingContainer isn't attribute but interface. Well, maybe, maybe it's because interface express contract (in this case class implementing INamingContainer promises it will be able to provide unique names for its children. ) while attribute just adds metadata.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
An interface works as a base class in the respect that you can create a reference to an interface, and use that reference for any class that inherits the interface. That enables you to use the members in the interface without needing to know the actual class of the object.
---
single minded; short sighted; long gone;
|
|
|
|
|
You missed the point, INamingContainer doesn't add ANYTHING to class implementing it, it's just marker. You do not use things as INamingContainer , you just ask them if they are INamingContainer . So from "how it works" point of view it could as well be attribute.
Guffa wrote: An interface works as a base class in the respect that you can create a reference to an interface, and use that reference for any class that inherits the interface.
I know how interface works, and I know how base class works.
Guffa wrote: class that inherits the interface.
You do not inherit interface, you implement interface. Inheritance express that something is specialization of base class, while implementing interface express that two possibly unrelated things have same capabilities (described in interface). That's little semantic difference.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hello All ,
Is There any way to Convert the Date in one Format to Another Format
I am taking Date in dd/MM/yyyy Format from my Calender to TextBox
Now I need to take this date from TextBox as a string and Convert to dateTime (i.e Convert.TodateTime(TextBox1.Text)) Having MM/dd/yyyy(i.e.System Specified ) Format
Thanks for any help anyone is able to give me.
|
|
|
|
|
Hi
For datetime function, it always take this format MM/dd/yyyy.
Call this function (added below) if your date format is dd/MM/yyyy:
public string ParseDateTime(string StrDate)
{
String StrReturnDate = "";
String StrDay = "";
String StrMonth = "";
String StrYear = "";
StrDay = StrDate.Substring(0, 2);
StrMonth = StrDate.Substring((StrDate.IndexOf("/") + 1), 2);
StrYear = StrDate.Substring((StrDate.LastIndexOf("/") + 1), 4);
StrReturnDate = StrMonth + "/" + StrDay + "/" + StrYear;
return StrReturnDate;
}
Harini
|
|
|
|
|
Try this:
string DATETIMEPATTERN = "dd/MM/yyyy";<br />
string strdate = "28/02/2007";<br />
DateTime mydatetime;<br />
DateTime dt;<br />
DateTime.TryParseExact(strdate, DATETIMEPATTERN, null, DateTimeStyles.None, out dt);<br />
mydatetime = dt;
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
Hi,
if you getting the date as dd/MM/YYYY format(e.g, 31/01/2007) convert it to the .NET compliant date format like, 31/JAN/2007. You can simply do so by calling the function GetMonth.
string dateValue = "31/01/2007";
string month = GetMonth(dateValue.Split('/')[1]);
Then perform the following
DateTime.Parse(stringDateTime);
You can easily set the datetime for the corresponding string
public string GetMonth(string monthNumber)
{
string [] monthName = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Nov","Dec"};
return monthName[Int32.Parse(monthNumber)- 1];
}
-- modified at 4:58 Wednesday 28th February, 2007
Mohan
|
|
|
|