The quickest fix I can think of is a hashtable. Use the calander object as the key and the textbox will be the value. Declare the hashtable globally and when you create a new 'control group' add the new value.
dim hash as new hashtable
'In the SetCalander method
'In the selectionchange event
'This will give you a reference to the appropriate textbox
dim txt as textbox = hash(sender)
This should work. It may not be the best solution but it was the quickest fix I could think of.
I have a windows application and I need to show some pictures that stored in the server. PictureBox could not show these files and I tried impersonation. But it still throws exception saying 'Unauthorized user'. How can I make the picture box show these images? Thanks a lot...
(I have to write image address like; 'http://server/images/image.jpg'
Ahhh, ok. Well in that case the IIS is most likely what is preventing you from accessing the location. You will either need to adjust the permissions of the directory or IIS in order to get this to work.
I have a VB NET application that connects to SQL Server and save some data.
When is executed from Windows is OK, but when I try to execute it from VBA (in this case, an Outlook Macro) I get several exceptions.... Like:
... "an error has ocurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections"...
Or some other Cast Exceptions...
I've tried with Shell, or the ShellExecute API....
Are you trying to run this application on a server that doesn't have anyone logged in? The error you gave usually happens when you can not reach the sql server. Is there some reason why you wouldn't be able to access the sql server from the PC you are trying to run the VBA script?
Yep. I'm logged in when I run the macro, and I have that server on my DNS.
The problem is not only when connecting to SQL Server, also, when I try to CAST "TRUE" (String) to TRUE (Boolean value) I get a Cast Exception. But that only happens when the application is running INSIDE the Macro.
If you are getting a cast exception, it must mean that your boolean value in your string "true" and "false" is not getting properly set. The only way you would get an exception is if the string is coming across as "" which wouldn't cast to a boolean. I am guessing that your parameters that you are passing into your exe are working different. when you call it from the run command it works as expected. I am wondering if the parameters that are getting passed in from the ShellExecute are adding some addional parameters so you are off by one. I would put a MessageBox.Show( in your form load to see what your input parameters are.
I don't know if you are using a sqluser and sql password for your connection string. If you are not it might be worth a try. Perhaps using the ShellExecute is causing the NTAuthentication not to work. Assuming you are using NTautheication in your connection string.
I'm still having the cast exceptions, so I've stop using the convertion from String to Boolean, so that is not a problem (for now....)
The exact SQL exception is:
... "an error has ocurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections"... (I'm using SQL Server 2000)
And I'm sure the start up method is working fine....
That is really weird. The only time I have gotten that error is when the sql server was actually down. I guess the only other thing I can think of, which I think you already checked is what the connection string it right before you open the connection in the vb.net app.