|
Hi,
I don't think there is any support for mimicking Explorer; anyway, the number of files/folder shown by Explorer depends on several settings.
FWIW: starting .NET 4.0 there are new directory methods that enumerate files/folders one by one rather than building an array first.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks, Luc. Unfortunately the app is supposed to run under W2K, so I'm afraid I have to limit my expectations regarding .NET4.0
But I found a workaround (posted here for others):
Dim drv as DriveInfo
For Each di As DirectoryInfo In drv.RootDirectory.GetDirectories("*", SearchOption.TopDirectoryOnly)
If Not di.Attributes And FileAttributes.Hidden Then
...(code)
End If
Next As a result I have the right count and no recycle-bin (i.e. the other unwanted stuff). The only thing still bothering is that I have the Englisch folder names for "Users" (instead of "Benutzer") and "Program Files" (instead of "Programme"). If anyone has an idea how to solve that - maybe it has to do with the 'cultures' in VS, which I didn't explore yet - I'd appreciate. But since it's not really important (even most of the users know some English ) and only relevant for the root drive, I might just skip the issue as well 
|
|
|
|
|
I want to plot a number of different cells from a sheet in to a bar chart. The cells may lie anywhere in the sheet (not necessarily in one row or column).
I have an array that stores the address of these cells.
This is what I am doing to plot the bar chart in VBA
Firstly, I make a string of the cell addresses (for eg DataSheet!$B$4, DataSheet!$B$3, DataSheet!$E$7, DataSheet!$G$11, DataSheet!$J$1)
Then pass this string to the chart for plotting
ActiveChart.SeriesCollection.Add Source:=Range(Str)
This works fine till the number of data points are less. But when the datapoints are large, the string grows bigger in size and the above plot function fails.
Is there nay other way I can accomplish this?
Thanks,
GJ
|
|
|
|
|
Hi,
I trust there are other ways, I am not familiar with them though.
Here is what you could do right away:
- drop the dollar signs
- drop the spaces
- rename the sheet to something that is much shorter.
DataSheet!$B$4, DataSheet!$B$3, DataSheet!$E$7, DataSheet!$G$11, DataSheet!$J$1
X!B4,X!B3,X!E7,X!G11,X!J1
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi GJ,
I'm not quite sure if I exactly understood what you're doing, but it seems to me as if you're doubling up unnecessarily and just make the string longer and longer. Maybe you wanna try adding your cells as single elements in a loop, like
For i = 1 to x '(= Number of Series)
ActiveChart.SeriesCollection.Add Source:=Range("DataSheet!$B$4")
ActiveChart.SeriesCollection.Add Source:=Range("DataSheet!$B$3")
....
Next
If you really add each cell manually, this is a big challenge anyway.
Hope it helps,
Mick
|
|
|
|
|
Thanks Mick for you reply. But wouldn't this create a lot of data series (one for each point)? I want all the points to be in one data series.
Thanks,
GJ
|
|
|
|
|
IC. You would then pass an array of strings to the values collection, e.g.
ActiveChart.SeriesCollection(index).Values = Array(Range("Sheet1!$A$29"), Range("Sheet1!$B$33"), Range("Sheet1!$C$35"), Range("Sheet1!$C$30")) But this you only need if your Ranges are spread over your sheet.
If you follow Daves advice and order them blockwise (in a hidden sheet), you can simply add the resulting (ordered) range like e.g.
ActiveChart.SeriesCollection.Add Source:=Range(Worksheets("Sheet1").Range("C5:T5"))
|
|
|
|
|
Write up some code to copy the values to a hidden sheet, in a nice ordered fashion, then supply that hidden range of values to the chart.
|
|
|
|
|
I use ie object to navigate in html page.
Now in the a page of site here is a table with a button...
When the user cklick on button the table is filled with a new data.
I think... the Button clcik send a notice to a Data Server where are stored the recordset(?!) and retrive a string with data to insert in table...
My question and dubt are:
Is possible to intercept the string of data before the code insert into table?
Is possible to intercept the source of data?
the page of site are all in ASP.
Tks.
|
|
|
|
|
sal21 wrote: Is possible to intercept the string of data before the code insert into table?
It might be possible with something like greaseMonkey.
sal21 wrote: Is possible to intercept the source of data?
I don't understand what you mean by that.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Dear All,
I develop a software for courier management system. It work find under window XP. My client install window vista. All Software run fine but sendkeys shows error.
Kindly Help me in this regard. My email address is redguysharma@yahoo.com.
Thank You,
RedGuy
|
|
|
|
|
Member 3676822 wrote: All Software run fine but sendkeys shows error.
What error?
BTW it is a very bad idea to publish your email address on a public forum. You are inviting spam-bots.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
VB6 and Vista is like smoked liver and ice cream. The combination could work but no-one would ever suggest trying it.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
SendKeys is notoriously unreliable to use. I would not be using it in a production application.
Either way, IIRC, the problem only showed up on the Beta versions of Vista. Well, that's the last time I heard of the problem anyway.
You can find a piece of code to replace the SendKeys call here[^].
|
|
|
|
|
Hi, I'm using Linq To SQL.
I've run this code :
Dim TmpDto = CallByName(TmpSrv, hfSelectedNode.Value, CallType.Get)
that returns a System.Data.Linq.Table(Of [A DB Table])
I need to filter this table with 'Where', the extension method, and when I used callByName, it said "The public method Where was not found"
As you has undrestood, I don't know table name in compile time, so I need to call it runtime.
How can I do it?
Best wishes
|
|
|
|
|
You'll have to post the code for the function you're trying to call.
BTW: CallByName is VERY slow. Using it is considered bad practice in a production application because of it's performance issues.
|
|
|
|
|
i want to call binding navigater addnew method on another button click
how i can do that
|
|
|
|
|
And you tried what exactly?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I have created a MDI application with many forms and created a few custom controls that are needed for the data. They are extended off of UserControls, most are composite controls, but not all.
When a user is on Form1, and a "Standard" text box has focus, the users switches to Form2 to check something, then back to Form1, The "Standard" text box still has focus when they return.
When using my "Custom" text box,(a UserControl with a text box droped on to it in the Designer) when the Custom text box has focus, when the user switches to the other form, and then back, some other field (usually lowest tabindex) ends up with the focus.
How do I setup my UserControl so that focus ends up back in it when our form looses and regains focus.
I have a skeleton program with the same error with none of my custom code in it that I can upload or email to you if it helps.
Its most likely something stupid, but I cant find it.
|
|
|
|
|
The problem is that when the user switches away from the initial form, the first event to fire will be that the form has gotten focus, after which the form will automatically move focus to the control with the lowest tab number, or to the control that you explicitly tell it to. So if the last control to have focus should always get the focus back, you need to monitor which control (for example your textbox) has focus at any time (for example by its index or tab number).
Then you can just set focus to that control when focus is brought back to the form.
In other words, the problem hasn't anything to do with your usercontrol.
My advice is free, and you may get what you paid for.
|
|
|
|
|
I agree that that is what is happening with my usercontrols, But when the focus starts out in a standard text box, that is not what is occurring. In the standard text boxes (or any other windows "standard" controls). when returning to the first form, the focus returns to where it was when we left the form automatically.
For example, a form with three controls, two textboxes, TabIndex 1 and 3, and my UserControl tab index 2
Tab Index 1 -> Jump off and return -> Tab Index 1 (as expected)
Tab Index 2 -> Jump off and return -> Tab Index 1 (the questionable one)
Tab Index 3 -> Jump off and return -> Tab Index 3 (doing what I want my control to do)
Also I have tried code to monitor what the last selected control was, and to reset it using OnEnter and OnLeave functions, but Even though it was doing LastControl.Focus() on the correct LastControl the focus was still ending up back at TabIndex 0 as if something else in the application was forcing it to go there for some reason. But even with every other reference to "Focus" in my code commented out, it still kept going back to 0. (Also in my basic test case that I created with out any other code in it, just standard controls and the absolutely fewest lines of code to make the forms show up.
Does anyone have an example of tracking the last control used? I could easily be doing something wrong, but with the time I have spent on this, I don't think so.
|
|
|
|
|
For those people looking through the archives and finding this. I ended up changing my UserControls into Panels. It comes with its own issues. But seems to have "fixed" the listed problem.
|
|
|
|
|
can anyone point me in a good direction. I am upgrading an old VB6 app. There are two primary forms. If I hide a form, then unhide it, it seems to change size. Any idea why this is or how I can stop it? (I generally show only one of the two forms at a time)
I do have a way to determine what size it needs to be but am not sure where to put my re-sizing routine (the form needs to be different sizes for different configurations) It is generally resized on the load event.
Thanks in advance
sorry, upgrading a VB6 app to .net, did not have issue in VB6
|
|
|
|
|
No-e wrote: If I hide a form, then unhide it, it seems to change size. Any idea why this is or how I can stop it? (I generally show only one of the two forms at a time)
Your best way to do this is to write both forms as controls, and then show/hide those on the same form. Having said that, there's no reason for yuor form to resize, you should post some code.
No-e wrote: I do have a way to determine what size it needs to be but am not sure where to put my re-sizing routine (the form needs to be different sizes for different configurations) It is generally resized on the load event.
I assume this means your load event is firing every time, have you tried breakpoints ? Does it need to be resized regularly, or only on startup ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Thanks for your response, if I might take a step back it may help as I also see this screen resizing when the form loads.
Private Sub frmChamber_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
frmChamber.DefInstance.Height = frachamber(0).Height + 214
If frmChamber.DefInstance.Height < fraControl.Height + 200 Then frmChamber.DefInstance.Height = fraControl.Height + 214
end sub
when this code runs, my height will be 645 in this case. It is very clear.
the code then returns to the
public sub new() routine and does a me.show(). Note this code was inserted by the update tool,I have not changed it, copied exactly as is)
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'For the start-up form, the first instance created is the default instance.
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows Form Designer.
InitializeComponent()
'This form is an MDI child.
'This code simulates the VB6
' functionality of automatically
' loading and showing an MDI
' child's parent.
Me.MdiParent = MBIG.mdiMain.DefInstance.DefInstance
MBIG.mdiMain.DefInstance.DefInstance.Show()
'The MDI form in the VB6 project had its
'AutoShowChildren property set to True
'To simulate the VB6 behavior, we need to
'automatically Show the form whenever it
'is loaded. If you do not want this behavior
'then delete the following line of code
'UPGRADE_NOTE: Remove the next line of code to stop form from automatically showing. Click for more: 'ms-help:
Me.Show()
End Sub
The form will then show on screen but will be much shorter than it was when I set it. I can re-size it again from the calling routine, but I am not sure why it would change.
Thanks for your help, I am hoping I am just not understanding how this works.
Mike
|
|
|
|
|