Despite a signifigant amount of research I have yet to be able to crack this one: I Need to be able to adjust the amount of items displayed in the listbox of the combobox - i.e. sometimes 4, sometimes 24, sometimes in between. I've noticed the windows API has a CB_SETDROPPEDWIDTH - but cannot find an equivilant for height (CB_SETITEMHEIGHT sets individual item height - doesn't adjust the listbox size). If it cannot be done through API calls (and i'm beginning to think it can't) then how? If it needs to be painted I would appreciate a brief example if possible?
ComboBox1.MaxDropDownItems should work in vb.net, in vb6 there is not a corresponding function, and in the api there is only a function to find out what the size and position of the dropdown CB_GETDROPPEDCONTROLRECT. You might look into creating a custom control in vb.net expose it to com and use it in your vb app.
Sorry I don't have anything more concrete, maybe someone else does.
I've got a webpage that has a selfmade webusercontrol.
That webusercontrol dynamically creates (at this moment only) a label control, a calendar control and a textbox control, depending on how many items I give the control through a Session.
So far so good, for every item in Session a set of these controls is created and added to the page.
They display nicely.
*I hear the collective going "BUT?"*
Ah yes, there's a "but".
What I want to do, is fill the textbox of a set with the selected date of the calendar object of THAT set.
But there are (in this example) two calendar objects.
NOTE: (I have to add the calendar objects dynamically as I don't know how many date type parameters will be required in the near future)
How can I get the selectionchanged event from one of the calendar, so that the control "knows" it's from that calendar and fill the correct textbox that belongs to that calendar ?
Don't forget, all the controls are being generated at runtime in a webusercontrol, which means that somehow I have to create dynamic eventhandlers that "knows" which calendar object had the selectionchanged event and "knows" which which textbox object to set the text of.
Code in VB.NET please, not ASP.NET.
Everything is being done in the code behind, which is VB.NET.
Some help would be greatly appreciated.
If I use a withevents declaration, I end up with only one calendar on the resulting page.
Seems as though it overwrites the first one.
Perhaps because it uses a global identifier within the control instead of one contained in a sub?
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.