|
I'm not seeing what your trying to describe. You mean you want to show a list of the parent nodes for each child node you click on?? Something like:
Parent1
Parent2
Parent3
ClickedChildNode
Every TreeNode object, whether it's a Parent and/or Child, has a Parent property that returns the parent node of the current node. For example, above, if you clicked on ClickedChildNode, it's Parent property would return the Parent3 treenode. All you have to do is keep getting the parent of each parent node until Parent returns Nothing, meaning your at the top of the tree.
TreeNode.Parent[^] property docs.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi, I need some help with the FOR EACH command, here is my code:
Dim b As New ToolStripMenuItem
For Each b In Me.cmsTestList.Items
Debug.Print(b.Name)
Debug.Print(b.Tag)
If b.CheckOnClick = True Then
If b.Tag = "check" Then
b.Checked = True
Else
b.Checked = False
End If
End If
Next
cmsTestList is of the type Windows.Forms.ContextMenuStrip
and
cmsTestList.Items returns a Windows.Forms.ToolStripItemCollection
I was under the impression that the object "b" will always be of the type: ToolStripMenuItem since I specified explicitly FOR EACH ToolStripMenuItem.
But the code tries looping through other items in my menu such as 'System.Windows.Forms.ToolStripTextBox'. This is not a ToolStripMenuItem as far as I know!
So resultingly the code breaks with the error:
Unable to cast object of type 'System.Windows.Forms.ToolStripTextBox' to type 'System.Windows.Forms.ToolStripMenuItem'.
I would never have thought that type casting will be necessary for this kind of implementation of the FOR EACH x IN command , and I don't know how to deal with this type casting either.
What I need to do is to loop through only the ToolStripMenuItems and not through all the other ToolStripItems as well!
Any ideas?
Kind Regards
you can't forget something you never knew...
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
It doesn't work the way you are thinking. The for each does not limit the type of controls in the collection. You need to do something like the following:
<br />
for each item as ToolStripItem in cmsTestList.Items<br />
if item.Type is GetType(ToolStripMenuItem) then<br />
'do your work here<br />
end if<br />
next<br />
Mike Lasseter
|
|
|
|
|
i'm using VB6
im about to finish my proj
it must play both of MP3 and WAV files
i need to play mp3 file from my proj without any control
just play it
thanx alot
|
|
|
|
|
You need to use the Windows Media Player control, and you can set it to not display anything.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi...
i am trying to create a vertical tab control in vb.net but could not manage to keep the alignment horizontal. What i want is that the tab should come in vertical but should be placed horizontally as in the startup property page of a project in vb.net.
anyone could please help me.
thanks
|
|
|
|
|
I want to make my form NEVER_Minimizable
to do that.....i;ve done this:--
Protected Overloads Overrides Sub WndProc(ByRef msg As Message)
If msg.Msg = WM_SYSCOMMAND Then
If msg.WParam.ToInt32 = SC_MINIMIZE Then
Else
MyBase.WndProc(msg)
End If
BUT, This never handles Windows + D (Show Desktop) keys..
How to handle that ??
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Try removing the control box/minimize button/form border to make it impossible for the user to minimize.
|
|
|
|
|
Here aint a NewBie stuff.....
I've said cancel d effect of Ctrl + M / Ctrl + D
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
vb.net
when i set alignment of a datagrid's columnheader to right, then the headertext's last letter on the right is halfway hidden. how can i avoid that?
|
|
|
|
|
Increase the column width.
|
|
|
|
|
it's not depending from the column header's width. the last letter is cut anyway.
|
|
|
|
|
Hello,
I'm trying to populate my ID and Dealername in my combobox, but when I try the below scripts, I'm only seeing the ID at runtime... How can I show both the ID and DealerName in my combobox?
<br />
Me.cboSelectDealer.DataSource = ReportDS.Tables("tblCall_Reports")<br />
Me.cboSelectDealer.DisplayMember = "UID" & "-" & " DealerName"<br />
Me.cboSelectDealer.ValueMember = "UID"<br />
<br />
Me.cboSelectDealer.DataSource = ReportDS.Tables("tblCall_Reports")<br />
Me.cboSelectDealer.DisplayMember = "UID" + "-" + " DealerName"<br />
Me.cboSelectDealer.ValueMember = "UID"<br />
Thanks in advance.
|
|
|
|
|
I realise this is an old post but it might help someone else out.
I needed to do a similar thing but I didn't want to concatinate fields in the sql used to fill the datatable as it was contained in an existing stored procedure. So I filled the datatable with the records I wanted then basically added another column in the datatable which was my concatinated display value. I then used this new column as the DisplayMember.
assuming we have a datatable which is populated with "AccountCode" and corresponding "AccountName"
eg "ABC" , "Freds workshop"
"XYZ" , "Bills Lighting"
'Add a new calculated column to the datatable
Dim DataCol As DataColumn = New DataColumn("Display")
DataCol.DataType = System.Type.GetType("System.String")
DataCol.Expression = "AccountCode + (' - ') + AccountName"
dt.Columns.Add(DataCol)
'Now setup the combobox
cmbAvailableCompanies.DataSource = dt
cmbAvailableCompanies.DisplayMember = "Display"
cmbAvailableCompanies.ValueMember = "AccountsCode"
It will now display "ABC - Freds Workshop" and "XYZ - Bills Lighting" in the combobox.
The only issue I have found is if I turn sorting of the combobox on the SelectedValue of the combobox gets out of sync with the Displayed value. I haven't worked this out yet but for the time being I can live with it.
|
|
|
|
|
Hi!
How do I allow the user to reload the main form of the application? In essence, I want a button that closes the whole program and opens it again, starting from scratch.
thanks
|
|
|
|
|
Write a method that sets the initial state of your controls and variables, call it in your form load ( so it always works the same ) and call it again from a button event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hii Friends
I have a form in my software in which if user is connected to internet can send an querry to my id, myid@gmail.com. Two textboxes one for sender email id will be written and another for subject, And the main querry in the multiple lines text box. i have a smptp and pop3 account with gmail.com as smtp.gail.com and pop.gmail.com . How can i do this which namespace i have to import for tat and the code is required.
I have been tryin on this
Please share if u have N E idea.
Thanks
Nikhil Bandekar
Mumbai,
India
|
|
|
|
|
This[^] works for me.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear all
i am trying to find out a way to store any mails recieved in MS outlook into a MSSQL database located remotely
can anyone help with this
the database has the following fields From_ID <varchar(40)> To_ID <varchar(30)> Subject <varchar(50)> Message <varchar(1600)> Date <datetime>
Its pretty urgent
Please Help
Gaurav
|
|
|
|
|
i am using the following code as connection string
for importing Excel file to dataset in Vb.ne
MDAC and Excel all r installed
but i got the following error "Could not find installed ISAM"
this work is urget for tomorow.can u help me
is this wrong.pls give the correct code.
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source='" & strfilename & "'; " & _
"Extended Properties=Excel 8.0;HDE=NO;IMEX=1")
|
|
|
|
|
|
hi,
Thanks a lot.........
last 3, 4 days i was so busy.thts why i cuould not sent mail to u.sorry for the delay
the link u have given me is verymuch helpful to me.
once again thanks.
|
|
|
|
|
Hi Viji,
No Problem, you are always wecome.....
Regards
sarathy
Know is Drop, Unknown is Ocean
|
|
|
|
|
Hello Everyone
I'm using VB. Net, can you tell me how to display records in a datagrid in a Date range. I have 2 DataAdapters, the other one has parameters "Date" and one DateTimePicker.
|
|
|
|
|
Dear Friends,
i have a problem, when i call the printtoprinter function i recieve an error
my code is
Dim Report As New rptCaisseAll
Dim Us, Fc, qty, prix, total, totcomis, bacv, bacl, soldefc, soldeus As String
RefCaisse.GetRcords("*", "CaisseDate in (select Max(CaisseDate) from Ref_PDCaisse where CaisseDate< convert(datetime,'" & Me.txtDate.Text & "',103))")
RefCaisse.FillBoxControlles("", Us, Fc)
Caisse.GetRecords("Exchrate,AmountUS,AmountFc,s.Notes,s.DbCr,AccName,s.AccNo", "EntryDate=convert(datetime,''" & Me.txtDate.Text & "'',103) And s.AccNo<>40101", "s.DbCr")
Caisse.SelectspecialMethod()
livraison.GetRecords("Sum(BacLiv) AS BacLiv", "LivDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
livraison.SelectMethod()
'comisTot.GetRecords("TotalComis", "ComisDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
'comisTot.SelectMethod()
fiche.GetRecords("Sum(Commission) as Commission", "OpDate<=convert(datetime,''" & Me.txtDate.Text & "'',103) And Operation=''Commande''")
totcomis = fiche.SumMontant()
fiche.GetRecords("Sum(Commission) as Commission", "OpDate<=convert(datetime,''" & Me.txtDate.Text & "'',103) And Operation=''Commission''")
totcomis = totcomis - fiche.SumMontant()
If Me.txtDate.Text = Now Then
stock.GetRecords("tblStock.OrdCode as OrdCode,tblStock.ArtCode as ArtCode,InQty,OutQty,FinalQty,tblProDetails.Qty As Qty", "tblProDetails.OrdCode=tblStock.OrdCode AND ProdDate=convert(datetime,''" & Me.txtDate.Text & "'',103) And (tblStock.FinalQty<>0 OR tblProDetails.Qty<>0) AND tblStock.DepCode=''KIC''", "ArtCode", 1)
stock.SelectspecialMethod()
Else
stock.Stock(CDate(Me.txtDate.Text))
stock.ClearSet()
End If
Report.Database.Tables.Item("ReCaisse;1").SetDataSource(Caisse.CaisseSet.Tables(0))
Report.Database.Tables.Item("RptSumLiv;1").SetDataSource(livraison.dsTable.Tables(0))
'Report.Database.Tables.Item("RptTotalComis;1").SetDataSource(comisTot.dsTable.Tables(0))
Report.Database.Tables.Item("RptStockProd;1").SetDataSource(stock.dsTable.Tables(0))
'commande.GetRecords("Sum(Qty) AS Qty", "ComDate<=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-1).ToString & "'',103)")
'commande.SelectMethod()
'Report.Database.Tables.Item("RptSumComYesterday;1").SetDataSource(commande.dsTable.Tables(0))
'livraison.GetRecords("Sum(BacLiv) AS BacLiv", "LivDate<=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-1).ToString & "'',103)")
'livraison.SelectMethod()
'Report.Database.Tables.Item("RptSumLivYesterday;1").SetDataSource(livraison.dsTable.Tables(0))
fiche.GetRecords("Sum(Qty) AS Qty", "OpDate<=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-1).ToString & "'',103) and Operation=''Commande''")
fiche.SelectMethod()
Report.Database.Tables.Item("RptSumComYesterday;1").SetDataSource(fiche.dsTable.Tables(0))
fiche.GetRecords("Sum(Qty) AS BacLiv", "OpDate<=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-1).ToString & "'',103) and Operation=''Livraison''")
fiche.SelectMethod()
Report.Database.Tables.Item("RptSumLivYesterday;1").SetDataSource(fiche.dsTable.Tables(0))
production.GetRecords("SoldeProd", "ProdDate=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-1).ToString & "'',103)")
production.SelectMethod()
Report.Database.Tables.Item("RptProductionSolde;1").SetDataSource(production.dsTable.Tables(0))
production.GetRecords("Qty,SoldeProd", "ProdDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
production.SelectMethod()
Report.Database.Tables.Item("RptProduction;1").SetDataSource(production.dsTable.Tables(0))
production.GetRecords("Sum(tblProDetails.Qty) AS Qty", "(ArtCode=''FRMDT'' Or ArtCode=''MIDMA'') AND ProdDate=convert(datetime,''" & Me.txtDate.Text & "'',103)", , 1)
production.SelectMethod()
Report.Database.Tables.Item("RptProDetails;1").SetDataSource(production.dsTable.Tables(0))
commande.GetRecords("Sum(Qty) AS Qty", "ComDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
commande.SelectMethod()
Report.Database.Tables.Item("RptSumCom;1").SetDataSource(commande.dsTable.Tables(0))
livraison.GetRecords("Sum(BacLiv) AS BacLiv", "LivDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
livraison.SelectMethod()
Report.Database.Tables.Item("RptSumLiv;1").SetDataSource(livraison.dsTable.Tables(0))
'client.GetRecords("Sum(BacLiv) as BacLiv,Sum(BacVide) AS BacVide")
'client.SelectMethod()
'Report.Database.Tables.Item("RptSumClient;1").SetDataSource(client.dsTable.Tables(0))
fiche.GetRecords("Sum(Qty) as Qty", "OpDate<=convert(datetime,''" & Me.txtDate.Text & "'',103) And Operation=''Commande''")
bacl = fiche.SumQty()
fiche.GetRecords("Sum(Qty) as Qty", "OpDate<=convert(datetime,''" & Me.txtDate.Text & "'',103) And Operation=''Livraison''")
bacl = bacl - fiche.SumQty()
fiche.GetRecords("(Sum(qty)-Sum(bacvide)) as Qty", "OpDate<=convert(datetime,''" & Me.txtDate.Text & "'',103) And Operation=''Livraison''")
bacv = fiche.SumQty
stock.GetRecords("Sum(FinalQty) As FinalQty", "ArtCode=''FRMDT'' AND DepCode=''KIC''")
stock.SelectMethod()
Report.Database.Tables.Item("RptStock;1").SetDataSource(stock.dsTable.Tables(0))
Acc.GetRecords("AccNo as x,AccNo,AccName,BalUS,BalFC,DbCr", "AccNo=46030")
Acc.SelectMethod()
Report.Database.Tables.Item("ReAccount;1").SetDataSource(Acc.SoAccSet.Tables(0))
commande.GetRecords("Sum(Qty) as Qty,Avg(Prix)as Prix,Sum(Total) as Total,Max(ComID)as ComID,Max(ClCode)as ClCode,Max(Notes)as Notes,Max(ComDate)as ComDate", "ComDate=convert(datetime,''" & Me.txtDate.Text & "'',103)")
commande.FillBoxControls(, , , , qty, prix, total, )
Comis = Double.Parse(total) - CInt(qty) * Double.Parse(prix)
Dim i As Integer = 1
Dim Bag(8) As String
Dim Sac(8) As String
Dim TotSac, count As String
Dim pcode, pdate, spro, des, a As String
pcode = ""
pdate = ""
spro = ""
des = ""
a = ""
TotSac = 0
count = 0
For i = 1 To 7
Bag(i) = Nothing
Sac(i) = Nothing
production.GetRecords("*", "ProdDate=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-i).ToString & "'',103)")
production.FilBoxCotrolles(pcode, Bag(i), pdate, spro, des, a)
production.GetRecords("Sum(tblProDetails.Qty) as Sac", "ProdDate=convert(datetime,''" & CDate(Me.txtDate.Text).AddDays(-i).ToString & "'',103) AND (ArtCode=''FRMDT'' OR ArtCode=''MIDMA'')", , 1)
production.FillSum(Sac(i))
If Bag(i) = Nothing Then
Bag(i) = 0
End If
If Sac(i) = Nothing Then
Sac(i) = 0
End If
If Sac(i) <> 0 Then
count += 1
End If
TotSac = Convert.ToInt32(TotSac) + Convert.ToInt32(Sac(i))
'production.FilBoxCotrolles(pcode, a, pdate, spro, des, Sac(i))
Next
soldefc = Nothing
soldeus = Nothing
Caisse.GetRecords("*", "EntryDate=convert(datetime,''" & Me.txtDate.Text & "'',103) And AccNo=40101")
Caisse.FillBoxControls(, , , , soldefc, soldeus)
If soldefc = Nothing Then
soldefc = Me.txtCFc.Text
soldeus = Me.txtCUs.Text
End If
Report.DataDefinition.FormulaFields.Item("Date").Text = "totext('" & Me.txtDate.Text & "')"
Report.SetParameterValue("SoldeFC", soldefc, "ReCaisse.rpt")
Report.SetParameterValue("SoldeUS", soldeus, "ReCaisse.rpt")
Report.SetParameterValue("Us", Us, "ReCaisse.rpt")
Report.SetParameterValue("Fc", Fc, "ReCaisse.rpt")
Report.SetParameterValue("Total", Me.Vend, "rptTotal.rpt")
Report.SetParameterValue("Commission", Me.Comis, "rptTotal.rpt")
Report.SetParameterValue("TotComis", totcomis, "rptTotal.rpt")
Report.SetParameterValue("BacLiv", bacl, "rptBag.rpt")
Report.SetParameterValue("BacVide", bacv, "rptBag.rpt")
'Report.SetParameterValue("Qty", Me.Comis, "rptTotal.rpt")
For i = 1 To 7
Report.SetParameterValue("Date" & i, CDate(Me.txtDate.Text).AddDays(-i).ToString, "RptProdSem.rpt")
Report.SetParameterValue("Bag" & i, Bag(i), "rptProdSem.rpt")
Report.SetParameterValue("Sac" & i, Sac(i), "rptProdSem.rpt")
Next
Report.SetParameterValue("TotSac", TotSac, "rptProdSem.rpt")
Report.SetParameterValue("Count", count, "rptProdSem.rpt")
Report.PrintToPrinter(1, True, 1, 9)
in the laste instruction i recieved the folowing error
An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException' occurred in crystaldecisions.crystalreports.engine.dll
Additional information: Logon failed
So any body can help me
|
|
|
|
|