|
Greetings!
I'm having trouble with my treeview. Once I select a node from the treeview, it invokes the AfterSelect event, re-fills my nodes and the re-executes the AfterSelect event (again) - thus re-filling my node tree:
Private Sub uxGpDirectoryTree_AfterSelect( _
ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) _
Handles uxGpDirectoryTree.AfterSelect
Me.StartDir += uxGpDirectoryTree.SelectedNode.Text + "\"
call fillDirectoryTree()
End Sub
Private Sub fillDirectoryTree()
Dim arrSubfolders() As DirectoryInfo
arrSubfolders = New DirectoryInfo(Me.StartDir).GetDirectories
uxGpDirectoryTree.Nodes.Clear()
For Each subfolder As DirectoryInfo In arrSubfolders
uxGpDirectoryTree.Nodes.Add(subfolder.Name)
Next
End Sub
I have debugged and it does cycle more than once. Any help would be greatly appreciated.
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Not exactly what I wanted, but DoubleClick seams to work.
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
It looks like you're wiping out your entire TreeView, then refilling it with the subdirectories under the node that was selected. Is this really what you want?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello frnds can u tell me how v can lock the movement of the alt+clrt+tab keys in a vb application
|
|
|
|
|
What do you mean by "lock the movement of the alt-ctrl-tab keys"? What does "lock the movement mean". Ctrl-Alt-Tab doesn't really do anything specific so it's hard to tell what you want this to do.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello buddy,
Alt+ctrl+tab key is used to move among the different applicaitons running on the window platform. So i want to stop the switching of the programs when my application is running on the system. if u knw pls help me
|
|
|
|
|
It's Alt-Tab and Alt-Shift-Tab that do that. The Ctrl key doen't do anything.
You'll have to write a low level keyboard hook to do this. Search the articles and Google for "vb.net keyboard hook" and you'll find some examples.
I wouldn't recommend doing this unless you had very specific reasons for including this "feature". "Just to have it" will get your app uninstalled in a heartbeat.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need some help on how to correctly use BeginInvoke.
Here's the scenario:
I have a panel on my form called Panel1 and I have a button that I use to execute a query that can have multiple resultsets.
I'm executing the query asynhcronously and then I dynamically add x number of datagrids to Panel1, where x is the number of resultsets returned by the query.
At the point at which I add the datagrid to panel1 the code stops executing and nothing gets added to Panel1.
I've looked at using the Control.BeginInvoke method but ended up making more of a mess of things.
Hope someone can help.
Thanks in advance.
The code looks something like this:
<br />
<br />
<br />
<br />
Public Delegate Sub MakeGrids(ByVal ResultsTable As DataTable)<br />
<br />
Private Sub ExecuteThreadedQuery()<br />
<br />
'do various things and fill a dataset with the query results<br />
<br />
'loop through each table in dataset<br />
For Each table as datatable in dataset.tables<br />
<br />
<br />
Dim NewGrid As New MakeGrids(AddressOf AddResultsGrid)<br />
<br />
'call the AddResultsGrid sub using BeginInvoke<br />
NewGrid.BeginInvoke(ResultsTable, Nothing, Nothing)<br />
<br />
<br />
Next <br />
<br />
<br />
End Sub<br />
<br />
<br />
Private Sub AddResultsGrid(ByVal ResultsTable As DataTable)<br />
<br />
Dim ResultsGrid as DataGrid<br />
<br />
'assign relevant properties to the grid and bind it to the ResultsTable which has been fed through<br />
<br />
<br />
'Add it to the panel<br />
Panel1.Controls.Add(ResultsGrid) '***AT THIS POINT THE CODE STOPS EXECUTING AND NOTHING IS ADDED TO THE PANEL<br />
<br />
<br />
<br />
End Sub<br />
<br />
<br />
|
|
|
|
|
Hello!
Suppose i want to navigate from one form (Form1) to another form (Form2), then i want to cancel the first form (Form1) and then only want to show second form (Form2). What should i do?
Regards,
Arfan Qadir
|
|
|
|
|
just do this
form1.hide
form2.show
V.Gopi
|
|
|
|
|
Just be advised that if you follow those steps and hide form1, the resources allocated with it still exist. The form really still exists but you can't see it.
|
|
|
|
|
Hello Everybody in this Discussion board!
I want to take input (like 2x^2+Sinx-log(x)-9) from user and then want to calculate its value at any value of x (like 2.6), then what should i do in VB.NET?
Thanx in advance for your assistance
Bye
Arfan Qadir
|
|
|
|
|
All you have to do is search the articles for "math expression parser"[^] and you'll come up with a bunch of examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Anyone know how to write a service to receive faxes?
|
|
|
|
|
The scenario can be best described as the following.
A form is created with only a label. A keyup event is added to the form so that when a key is pressed the value of that key is added to the label.
Now when I add a couple of radio buttons and a standard button to the same form, this procedure does not work.
I want the form to handle the key event not some control. Why can I not set the form to have focus when other controls are present?
I hope this makes sense!
Thanks!
|
|
|
|
|
Set the KeyPreview propery of your form to TRUE.
|
|
|
|
|
Hello,
I am trying to export the contents of a datagrid to Excel.
Here's the code I have so far:
<small> 'Fire up an Excel instance
Dim ExcelApp As New Excel.Application
ExcelApp.Visible = True
Dim workbooks As Workbooks = ExcelApp.Workbooks
Dim workbook As _Workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet)
Dim sheets As Sheets = workbook.Worksheets
Dim worksheet As _Worksheet = CType(sheets.Item(1), _Worksheet)
'Put some data on the Worksheet -- This doesn't work, but throws no errors
Dim nCell As Integer = 5
Dim Range2 As Range = worksheet.Range("A1", "E1")
Dim array2(nCell) As Integer
Dim i As Integer
For i = 0 To (array2.GetLength(0)) - 1
array2(i) = i + 1
Next
Dim args2(1) As Object
args2(0) = array2
Range2.GetType().InvokeMember("Value", BindingFlags.SetProperty, Nothing, Range2, args2)</small>
Everything works except the last line. Actually, the only thing I have been successful at doing was getting the Excel app to fire up. Beyond that I am left looking at beautiful, although empty, white cells.
I'm using VS.Net 2005 latest beta.
It seems simple enough... Read a datagrid, send the results to an Excel worksheet. I would use the more accepted method of using Response.Write, but due to our website configuration, things get all screwed up with using a Master page and <form> tags.
If anyone can help me out of this bind, I would be a very happy programmer.
|
|
|
|
|
AFAICT, you can't bind an array to an Excel Range. You have to inster the values into the cells, one at a time.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
...that seems to be where I am stuck at - inserting the values one at a time.
Using the code:
Dim args1(1) As Object
args1(0) = nCell
Range1.GetType().InvokeMember("Value", BindingFlags.SetProperty, Nothing, Range1, args1)
..I get an error that states: "Public member 'GetType' on type 'Range' not found."
Since I'm using VS.Net 2005, I am wondering if there is a library I am missing or if the function has been removed altogether.
That is where I am at. Inserting the data, even a single cell value is proving to be my ticket to insanity. So close, yet so far.
|
|
|
|
|
First, the Range object is a little more difficult to use when filling in cells like this. The Cells object lets you index rows and columns sperately. Second, I'm wondering why your going through all the InvokeMember stuff when a simple assignment will do:
For I As Integer = 1 to 5
worksheet.Cells(I, 1) = I
Next
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I had no idea it could be that simple. This is a project for work (I'm normally a DBA by trade) and I'll plug in first thing Monday morning and give this a whirl.
You have been incredibly helpful, Dave and I really appreciate your expertise.
(I was just about to give up on this whole Excel thing and tell my boss if he wants the info on the website, just copy/paste it...
I'll let you know Monday how it all works out. If I can get just one cell to reflect info off the ASP page, I'll consider this a success.
Ray
|
|
|
|
|
Dim CRApp As New CRAXDRT.Application<br />
Dim CRRpt As New CRAXDRT.Report<br />
Dim CRTbl As CRAXDRT.DatabaseTable<br />
<br />
Set CRRpt = CRApp.OpenReport(App.Path & "\Reports\Products.rpt)<br />
CRViewer.ReportSource = CRRpt<br />
CRViewer.ViewReport
I am using Password Protected Access Database, Report show only those records which were recorded before report designing. On Execution the code given above ,there is no error. While Refreshing report pressing refresh button from
Report Viewer causes an error dexcribed as under:
Logno Failed.
Details: ADO Error Code: 0x80040e4d
Source:Microsoft JET database Engine
Description: Not a Valid Password
SQL State: 3031
Native Error: -124782449
Shoaib Nawaz
|
|
|
|
|
Greetings!
If I have a control in a split-panel, which is in a tab control, which is in a form -- how can I obtain the absolute location of the original (button) control?
Dim o As Control = LogPhotosToDbBtn
Dim x As Integer = LogPhotosToDbBtn.Location.X
Dim y As Integer = LogPhotosToDbBtn.Location.Y
While (o.Parent.Name <> "")
o = o.Parent
x += o.Location.X
y += o.Location.Y
End While
Dim p1 As Point
p1.X = x
p1.Y = y
LogFotosForm.Show()
LogFotosForm.Location = p1
X and Y are never incremented because o.Parent.Name always return "".
Is there a better way (one that actually works) of trying to do this?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Have you tried stepping through this in debug mode?
The line:
o = o.Parent will fail when you get to the form level because the form has no parent object.
That may be part of your problem ...
|
|
|
|
|
I did try to debug it, it never enters the while loop -- even tho the control is buried in several levels of parent containers.
Does o.Parent.Name return the parent's container's Name property?
If not, what does?
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|