|
Thanks, and best wishes for the coming year
Bastard Programmer from Hell
|
|
|
|
|
Hello,everyone!
I want to find a winform by its name in my project. At first, I thougt it could return the specific form with codes like below:
for each iForm as Form in XXX
return iForm
next
Is this right or not? If right, what's the collection included forms of project? If wrong, what should I do?
Would you give me some suggestions or demo?
Thanks!
|
|
|
|
|
if it is a visible form belonging to your own process, iterate the Application.OpenForms collection.
Otherwise, you will need to enumerate all the Windows windows using the EnumWindows[^] function (in user32.dll) using P/Invoke.
|
|
|
|
|
Thanks in advance,
I want to Update child nodes of a node, like in my XML document i have a node "Name", i want that it will search for its child Node "First_Name" having inner text "FN2" and then will update its Parents other child nodes like "Middle_Name" and "Last_Name".
I had asked this Question Here
www.codeproject.com/Questions/305565/how-to-Update-more-then-one-child-nodes-in-vb-net[^]
and got answer to obtain this Using LINQ , is there any other way to do this
Xml File
="1.0"
<Names>
<Name>
<First_Name>FN 1</First_Name>
<Middle_Name>MN 1</Middle_Name>
<Last_Name>LN 1</Last_Name>
<Country_Code>001</Country_Code>
<Area_Code>
</Area_Code>
<Phone_No>
</Phone_No>
<Email_Address>mail@email.com</Email_Address>
<Address>Address 1</Address>
</Name>
<Name ID="2">
<First_Name>FN2</First_Name>
<Middle_Name>Mn2</Middle_Name>
<Last_Name>Ln2</Last_Name>
<Country_Code>02</Country_Code>
<Area_Code>002</Area_Code>
<Phone_No>0002</Phone_No>
<Email_Address>email@mail2.com</Email_Address>
<Address>
</Address>
</Name>
</Names>
Code:
Function Edit() As Boolean
Try
'Dim xd As New XmlDocument()
'xd.Load(App_Path)
'Dim nod As XmlNodeList = xd.SelectNodes("//First_Name[. = '" & txtFName.Text & "']" & "/parent::node()/First_Name")
'If nod IsNot Nothing Then
' For Each node In nod
' 'nod.Item(0).ChildNodes(0).InnerText = txtMName.Text.Trim
' 'nod.Item(0).ChildNodes(1).InnerText = txtLName.Text.Trim
' Next
'End If
Dim xd As New XmlDocument()
xd.Load(App_Path)
Dim nod As XmlNode = xd.SelectSingleNode("//First_Name[. = '" & txtFName.Text & "']" & "/parent::node()/First_Name")
If nod IsNot Nothing Then
nod.ChildNodes(0).InnerText = "33"
nod.ChildNodes(1).InnerText = "333"
End If
Edit = True
Catch ex As Exception
MessageBox.Show(ex.Message)
ctlStatus.Text = "Current State : " & ex.Message.ToString
Return False
End Try
Return Edit
End Function
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Use SelectNodes instead of the SelectSingleNode method to return a collection of nodes. See the MSDN Article Select Nodes Using XPath Navigation for more info.
The alternative to to create an XSLT
"You get that on the big jobs."
|
|
|
|
|
what is the error in the bleow: 'Public Event OnFilterAdded()' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports Tawammar.CustomControls
Partial Class Filter
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
DataFilter2.DataSource = SqlDataSource2
DataFilter2.DataColumns = GridView1.Columns
DataFilter2.FilterSessionID = "Default.aspx"
DataFilter2.OnFilterAdded += (DataFilter2.OnFilterAdded + New
DataFilter.RefreshDataGridView(DataFilter2_OnFilterAdded))
End Sub
Protected Overrides Sub OnLoadComplete(ByVal e As EventArgs)
If Not Page.IsPostBack Then
DataFilter2.BeginFilter()
DataFilter2.AddNewFilter("Emp_ID", "Emp_Name", "Dav")
End If
End Sub
Private Sub DataFilter2_OnFilterAdded()
Try
DataFilter2.FilterSessionID = "Default.aspx"
DataFilter2.FilterDataSource()
GridView1.DataBind()
Catch e As Exception
End Try
End Sub
i know the erorr in
DataFilter2.OnFilterAdded += new DataFilter.RefreshDataGridView(DataFilter2_OnFilterAdded);
I have to use AddHandler statement but i dont know how i sepnt two days but Unfortunately I still new in VB programming
|
|
|
|
|
The += syntax for adding an event handler to an event is OK in C#, but it does not exist in VB.NET AFAIK.
You'll have to use an AddHandler statement, see the relevant MSDN page[^], or look it up in your VB.NET book.
|
|
|
|
|
Hi,
I'm searching for an example of an API hook for ExitWindowsEx.
I want to intercept the Shutdown/Restart of windows, do some stuff and go on with the ShutDown or Restart.
Ik know how to intercept the ShutDown with WM_QUERYENDSESSION but
that doesn't give me back which option the user has chosen: ShutDown or Restart.
I'v been searching the internet now for a few evenings with no results.
I'm using VB6 and VB2008. but any example would be appriciated.
Can anyone provide me with an example ???
Thank you !!!!
Ed
|
|
|
|
|
I can't help you in VB6, the language was obsoleted in a previous century.
In VB.NET, I suggest you have a look at SystemEvents[^], you probably won't need Windows messages nor P/Invoke.
|
|
|
|
|
Hi Luc,
Thank you but i know about the SystemEvents in vb.net.
The SystemEvents.SessionEndings.SessioEndReadings gives you back the reasons: Logof and SystemShutdown.
The SystemShutdown is the one which is given back in case of ShutDown OR Restart.
So I still can't tell which one the user selected.
That's why it was suggested to use an API hook.
I have a working example with SystemEvents...
gr.Ed
|
|
|
|
|
Hello,
I am not sure if this is allowed or not – if this post is against any Rules i apologize in advance and this post can be removed.
I am in the process of creating a open-source project to track the Psychological Mood of a person, this application will be used by people visiting psychologists.
Target Audience
People that are currently in therapy or want to keep track of mood changes. The program is based on CBT.
Aims
To provide to the end-user the tools for him to be able to monitor his mood.
To provide to the therapist additional information for the client through the automatic generation of graphs.
To reduce the international suicide rate.
To make this application available for everyone to use.
We are looking for some volunteers to help with Coding of the Project.
The Project has been seperated into three parts for easier management.
The Desktop Application is coded in VB.NET and using an ORM called nHibernate.
Project URL: http://moodtracker.codeplex.com
The Web-Based Application will be coded in C# and use MSSQL as the Database.
Project URL: http://webmoodtracker.codeplex.com/
The iPhone Application.
Project URL: http://iphonemoodtracker.codeplex.com/
We're aiming to develop a feature-rich Psychological Mood Tracker to help the end-users as much as we can.
If anyone is interested please feel to apply to the CodePlex Project Page.
Thank you in advance.
Constantinos
|
|
|
|
|
Not against the rules but probably not the correct forum.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hello gurus,
I hope someone is around these days, and to everyone who sees this I want to wish a Merry Christmas and a Happy Holiday!
But "let's get down to business": In my application I have to update the form from a different thread, which I do with the following code:
Private Sub UpdateProgress(ByVal value As Integer, ByVal labelText As String)
If StatusStrip.InvokeRequired Then
StatusStrip.Invoke(ProgressUpdater, New Object() {value, labelText}) <---- ERROR
Else
If value > StatusProgressMain.Maximum Then value = 100
StatusProgressMain.Value = value
StatusLabelMain.Text = String.Format("{0} Records", mDVdata.Count)
End If
End Sub Unfortunately I run into 'NULL referece exception' when invoking the StatusStrip although neither the value nor the labeltext variables are NULL. Do I probably overlook something like a plain syntax error?
Thank you for reviewing and any hint!
Mick
EDIT / RESOLUTION:
The exception turned out to be thrown in a different part of the procedure, the 'Else' clause: The mDVdata datatable wasn't properly declared!
modified 23-Dec-11 7:05am.
|
|
|
|
|
Which reference gives the exception?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi Richard,
the reference is "Object reference not set to an instance of an object". Would that probably mean that I have to declare another instance of ProgressUpdater? I suppose there's already one instantiated by
Private Delegate Sub AsyncDelegate(ByVal value As Integer, ByVal labelText As String)
Private ProgressUpdater As New AsyncDelegate(AddressOf UpdateProgress) right at the start of the form class?
Thanks again
Mick
|
|
|
|
|
Michael Schäuble wrote: the reference is "Object reference not set to an instance of an object".
Yes but which reference? You have an object reference in your code that has not been initialised so you need to look into your code (maybe with the debugger) to find out which it is and why it is still null.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, Richard - I put the resolution into the main messages edit. And: You're absolutely right !
Merry Christmas again!
|
|
|
|
|
I suspect that the ProgressUpdater delegate might not have been initialized.
|
|
|
|
|
Hi Shameel,
I have these two lines right at the beginning of the class:
Private Delegate Sub AsyncDelegate(ByVal value As Integer, ByVal labelText As String)
Private ProgressUpdater As New AsyncDelegate(AddressOf UpdateProgress) Would that be sufficient?
|
|
|
|
|
Michael Schäuble wrote: Would that be sufficient?
Should be.
Can you check which element of your code is throwing the null reference exception? If your StatusStrip is itself null, then your designer generated code might be screwed up.
|
|
|
|
|
But in that case the If-clause would throw the exception, wouldn't it?
|
|
|
|
|
Michael Schäuble wrote:
But in that case the If-clause would throw the
exception, wouldn't it?
Yes, it usually would. But it is also possible that the Invoked method is throwing the error and since it does not have a Try Catch block, it is being pushed backed up the stack. Add Try Catch and some custom logging to find out where the problem exactly is.
|
|
|
|
|
Thank's for your help, Shameel. I found it out and put the answer into the main message as an edit.
Merry Christmas again!
|
|
|
|
|
You're welcome. As I have mentioned in my other post, since there is no Try Catch block, the exception is pushed up the stack and is handled by the called method at the Invoke call.
|
|
|
|
|
How to create a Table in a VB6 application. Ihave the following code
Private Sub createDB(dbname As String)
Dim db As Database
Dim td As TableDef
Dim fld As Field
Set db = DBEngine(0).CreateDatabase(dbname, dbLangGeneral)
Set td = db.CreateTableDef("Students_Info")
With td
Set fld = .CreateField("Rollno", dbNumber, 3)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("FirstName", dbText, 15)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("LastName", dbText, 15)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("DOB", dbDate)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Class", dbText, 6)
.Fields.Append fld
Set fld = .CreateField("Subjects", dbText, 6)
.Fields.Append fld
Set fld = .CreateField("Mobile", dbLong, 10)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Father's_name", dbText, 30)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Mother's_Name", dbText, 30)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("Address", dbText, 60)
fld.AllowZeroLength = False
fld.Required = True
.Fields.Append fld
Set fld = .CreateField("E_Mail", dbText, 30)
.Fields.Append fld
End With
db.TableDefs.Append td
End Sub
Please Help
Needed for my project
Gopal_Krishan
|
|
|
|