|
You said you're putting this database in the \Windows\System32 folder? Did it occur to you that not every user account has full access to that SYSTEM folder? You might want to pick a better place to put that database before you try and access it, like in the root of the Users profile or in the Temp folder. Even if all you're doing is querying the Access database and not making any changes to it, you still need full read/write permissions to the FOLDER that the .MDB file is in.
And for why it works on your dev machine and not on others - did you develop your app under an Admin account?? Not a good idea - even though most developers do this...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
both computer have the same os , and i login as admin in both computer so it is not for permission .
|
|
|
|
|
Hi,
I have a class which uses async sockets functions (i.e. BeginXXX ).
One of the functions in my class for example is Listen() .
In my callback functions I would like to fire events.
These events could sometimes be used to control the UI.
So what I'm looking for is a way to invoke the events on the calling thread instead of the callback's thread.
I thought of holding a reference to a Control object inside my class.
This reference would be sent to my class through the constructor, and I could then call Invoke() on it.
But what if its not a Control which called my Listen() function?
Is there any way to know which thread is the calling thread, and invoking the events on it?
Thanks in advance,
Shy.
|
|
|
|
|
Hi Shy,
You can't really invoke the callback function on the calling thread, as that would have to be invoked Synchronously.
I'm assuming the reason you are trying to do this is because you can only manipulate GUI components from the thread they were created on (Static compartment). If this is the case, then you don't need to worry about using the calling thread to throw the events.
Instead, raise the events, and supply a delegate to the application Form, Form.Invoke(myDelegate)
This will run whatever code you need executing on the forms creating thread which will do any UI manipulations you need.
If that's not what you wanted, shout back and i'll have another look.
Tris
|
|
|
|
|
Tristan Rhodes wrote: Instead, raise the events, and supply a delegate to the application Form, Form.Invoke(myDelegate)
Hmm... Not really sure what you mean...
Could you please give me an example?
In the meanwhile, I did the following, but I'm not really sure this is the right way:
class TCPSocket
{
public event ConnectedEventHandler Connected;
private Control user;
public TCPSocket(...) { ... }
public TCPSocket(..., Control user)
{
...
this.user = user;
}
private void RaiseConnectedEvent(IPEndPoint ep)
{
if (Connected != null)
{
if (user != null)
user.Invoke(Connected, ep);
else
Connected(ep);
}
}
} In my callbacks I use my RaiseXXXEvent() methods.
So basically this is how I invoke all of my events...
I'd be glad to hear your opinion about my code...
Is there something wrong with what I'm doing?
|
|
|
|
|
Hi Shy,
I think the layouts a bit skewed.
You shouldn't really need to supply the control if the control can subscribe to the event.
try just using:
<br />
private void RaiseConnectedEvent(IPEndPoint ep)<br />
{<br />
if (Connected != null)<br />
{<br />
Connected(ep);<br />
}<br />
}<br />
Then subscribe the relevant form to the event
<br />
class MyForm<br />
{<br />
TCPSocket socket;<br />
Control myControl;<br />
<br />
private void SocketEventHandler(object sender, SocketEventArgs e)<br />
{<br />
<br />
me.Invoke(RunGuiThing);<br />
}<br />
<br />
private void RunGuiThing()<br />
{<br />
myControl.BackgroundColor = Color.Green;<br />
}<br />
}<br />
<br />
Hope that solves it
Tris
|
|
|
|
|
Indeed, that is possible.
I just thought I'd add a built in functionallity to invoke the events on the GUI thread.
|
|
|
|
|
Ah!
In that case - this should work:
<br />
class TCPSocket<br />
{<br />
public event ConnectedEventHandler Connected;<br />
<br />
private Control user;<br />
<br />
public TCPSocket(...) { ... }<br />
<br />
public TCPSocket(..., Control user)<br />
{<br />
...<br />
this.user = user;<br />
}<br />
<br />
private void RaiseConnectionEvent(IPEndPoint ep)<br />
{<br />
if (user != null)<br />
user.Invoke(this.Invoker, new object[]{ep});<br />
else<br />
this.OnRaiseConnectedEvent(ep);<br />
}<br />
<br />
protected virtual void OnRaiseConnectedEvent(IPEndPoint ep)<br />
{<br />
if (Connected != null)<br />
{<br />
Connected(this, ep);<br />
}<br />
}<br />
<br />
private void Invoker(IPEndPoint ep)<br />
{<br />
OnRaiseConnectedEvent(ep)<br />
}<br />
}<br />
Tris
|
|
|
|
|
Hmm...
Why do we need the proxy Invoker() method?
user.Invoke() can accept an event as the 1st parameter, so why send it a function which raises the event?
Am I missing something here?
|
|
|
|
|
Hmm, didn't know that, but it makes sense.
I think the delegate route makes it more flexible if you want to add info in the EventArgs with details about the executing thread.
I'm not actualy sure what you're asking, the origional version would have worked, so what is the problem?
Tris
|
|
|
|
|
Well, I just wanted an opinion on my code, as I wasn't sure it's a good practice to send a Control object to the constructor.
I think I'll hold a reference to System.ComponentModel.ISynchronizeInvoke instead of a Control object, so it would be more generic...
Anyway... Thank you very much!
Much appreciated!
|
|
|
|
|
Cool, np.
Good luck, let me know how it all ties up.
T
|
|
|
|
|
Hi,
There is a project with classes (businessLayer) referenced from the clients (WinForms) project. So the BusinessLayer dll is sitting on the client. What happens if the businessLayer changes in the future? How will the clients pick up the new dll?
Please note that for business purposes this is how the solution is setup.
Thanks
|
|
|
|
|
i use AxShockwaveFlashObjects in VS.net 2003 , but when i run the exe of this project , on framework 2 , this object cause error!!!!!!!!
why?
how could i solve this problem!!!
|
|
|
|
|
I use AxShockwaveFlash object in C# , and when the user click the right button of mouse on it , he/she can see the flash menu ,how could i hide this menu?
|
|
|
|
|
Put Stage.showMenu = false; in the first frame of your flash.
|
|
|
|
|
thanks , but it dosent work on win app. im using flash object in windows application.
|
|
|
|
|
Hi, I am using XslCompiledTransform class to convert xml files to html with xsl.
Evething is good but when input comes with special char it also convert them to html; like " < to < "
I don't want this. Because I need them in html like
blah blah as it orjinal.
What must I do.
<br />
StringBuilder sb = new StringBuilder(); <br />
<br />
XPathDocument XPathDoc = new XPathDocument(NewsXmlFile);<br />
<br />
XslCompiledTransform XslTrans = new XslCompiledTransform();<br />
XsltSettings settings = new XsltSettings(true, true); <br />
XslTrans.Load(Server.MapPath(@"xsl\NewsDefault.xsl"), settings, null); <br />
<br />
XmlWriter xtw = XmlTextWriter.Create(sb); <br />
XslTrans.Transform(XPathDoc, (XsltArgumentList)null, xtw); <br />
uxNewsBody.InnerHtml = sb.ToString();<br />
karanba
|
|
|
|
|
hi every one, i know i have alot of stupid questions regarding networking and this's one i hope you can help me with..
i created a virtual directory using IIS5.1, now when i cant get to the index inside this, i used strange applications that told me my ip adress is blah blah blah and when i tried what they told me i get the common 401 authuntication error despite providing the right username/password, pleas help me
ps. this's my ip settings
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : lan
IP Address. . . . . . . . . . . . : 10.0.0.6
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.0.0.138
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hey, your IP seems to be on a private network, so unless I misunderstood your question, the 401 error you may be getting is because your not trying to connect to your IIS installation, but to the administration panel of your Router. Try opening up a web browser on a system in your network, and type in http://10.0.0.6 , it should work.
If it does then you'll need to port forward port 80 (and any other ports you want) to that IP with in your router.
|
|
|
|
|
?????
didnt understand anything dont worry, i think apache is making me some troubles, thanx any wayz.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I have made a file using the following (with the writestream):
int written = 0;
while (written < listView1.Items.Count)
{
sw.WriteLine(";" + " Name: " + listView1.Items[written].SubItems[0] + "; Address: " +
listView1.Items[written].SubItems[1] + "; City: " + listView1.Items[written].SubItems[2] + "; State: " +
listView1.Items[written].SubItems[3] + "; Zip: " + listView1.Items[written].SubItems[4] + "{}" );
written = written + 1;
}
I am now trying to open the files by first seperating them into each set, and then seperate the properties. The code for that part looks like this(so far).
string[] TestString = Regex.Split(OpenedFile, "{}", RegexOptions.None);
int TestStringLength = TestString.Length;
int number = 0;
while (number < TestStringLength)
{
string[] StringSplit = Regex.Split(TestString[number], ";", RegexOptions.None);
}
What i want is to be able to put all of the seperate values back in their appropriate spots in a listview. Could someone please explain to me what i should do now?
Thanks in advance.
|
|
|
|
|
Assuming from the code that the order written to the file and the order in listview is same, you can create a ListViewItem and add the value to the listview.
ListViewItem lvwItem = new ListViewItem(StringSplit[0].Split(':')[1]);
for(int = 1; i < StringSplit.Length; i++)
{
lvwItem.SubItems.Add(StringSplit[i].Split(':')[1]);
}
ListView1.Items.Add(lvwItem);
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
|
|
|
|
|
does anyone know a free web hosting service that supports published c# apps?? i just uploaded my files to geocities and it's not working
thanx!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|