|
sir, could u pls tell me ho wto create button back in vb.net?i m very new to this vb.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
-- modified at 23:26 Monday 24th April, 2006
|
|
|
|
|
Keep this in the same thread please!
And you still haven't said what you mean by "back"... Back what?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
owh, i mean, that button will go back to the previous window,which is frmMain, when user click on it.i m vy sorry to bother u sir.thank u for ur help
-- modified at 23:56 Monday 24th April, 2006
|
|
|
|
|
You can call it anything you want, but usually they're called "OK" and "Cancel". The simplest form of this is to put these 2 buttons on a form and in the click events set the forms DialogResult property. You also set the form's AcceptButton property to the OK button and its CancelButton property to the Cancel button (after you put the buttons on the form!)
Private Sub OKButton_Click(blah, blah) Handles OKButton.Click
Me.DialogResult = DialogResult.OK
Me.Close()
End Sub
Private Sub OKButton_Click(blah, blah) Handles OKButton.Click
Me.DialogResult = DialogResult.Cancel
Me.Close()
End Sub
In the form that puts this form up:
Dim myNewForm As Form2
If myNewForm.DialogResult = DialogResult.OK Then
' Do whatever based on the data in myNewForm
End If
myNewForm.Dispose()
There's a more to forms and buttons than this, but way too much for a forum environment.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have create an application which receive a command argument,
The sub main will check the process list, if the same with my application process name,
it will terminate. It is my stupid method to control single instance.
But how can I get the second command argument?
For example,
First time, command argument is "Hello"
and the application shows "Hello"
Second time, command argument is "World!"
but the process list contains my process name, and so it terminate.
How can I send the "World!" to existing instance of my application?
Can I add any listener to do that except adding a watch file handler?
Please advise, Thank you!
|
|
|
|
|
All you have to do is search the articles for "single instance" and you'll find a few examples of what you're talking about. Or click here[^]...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi everybody ,
can you tell me please how to update a database with a command builder ?
actualy i know the code to do it ,or the codeS to do that & i want you see this S cuz i found many codes do that
i havn't understood all the statements can you axplain to me please ??
thank you very much;)
try to be good if you can't be the best
|
|
|
|
|
please i want to know how can i bind a file music with a event in ma application
for example from load untill unload or when we click a button or .....
can you help ??
thnx even if you can't
try to be good if you can't be the best
|
|
|
|
|
Hi ,
sorry the title wasn't clear enough isn't it ??
anyway thank you , i will give you an example to let you better understand
i have two forms in the first i have a textbox & a button & in the second i have a label & a button too
i want when i pick the button in the first form ,the second form shown & when i pick the button of the second one , the content of the textbox in the first form shown on the label
i hope you understand this stupide english please if you know how just tell me
thank you again
try to be good if you can't be the best
|
|
|
|
|
In Form1's Button Click event, write the following code.
[code]
Load Form2
Form2.Show
[/code]
In Form2's Button Click event, write the following code.
[code]
Me.Label1.Caption=Form1.Text1.Text
[/code]
|
|
|
|
|
how to create button back ..i dunno how to create it!!
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WHAT SHOULD I PUT HERE ???
End Sub
-- modified at 23:11 Monday 24th April, 2006
|
|
|
|
|
And a "button back would be...?? Were going to need a bit more information to figure out what you even want to do, let alone how to do it...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi ,
please i need to build an application in vb.net 2003 & i'm just a beginer that mean i need some help from profs like you
please if you can tell me how can i make my own cotrols (a button for example) i want to use it in ma windows application
if you don't know how just tell me how to affect the XP Style on your controls
thank you very much for your help
try to be good if you can't be the best
|
|
|
|
|
Making your own controls is not something that can be explained in a forum post. This subject can take up entire books and still not tell you everything about control creation.
As you've probably figured out by now, this will take a lot of research. Start Googling for "vb.net create custom control" and you'll come up with a large list of articles covering a wide range of control creation.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thnx for the advice man
i have sought before & i knew something called User controls i tried with them but actualy i didn't understand
i know this is stupide but can you help ?? do you have any good sourses something like that ??
try to be good if you can't be the best
|
|
|
|
|
My best source is Google. I taught myself everything I know about custom controls by trial and error and Google. There is no one site that has everything you need to know, not even the basics, on how to create your own custom control.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I wrote a small app in Visual Studio 2003 for a pocket pc which works well in the emulator but comes up with the following error when running on the device itself:
SmartDeviceApplication1.exe
TypeLoadException
Could not load type
System.Data.SqlServerCe.SqlCeRemote
DataAccess from assembly
System.DataSqlServerCe,
Version=1.0.5000.0
What do I need to do to correct the problem.
Thanks for any help!
|
|
|
|
|
Is there a way to override the code that vb.net generates for Deletes, Updates and Inserts?
The code generated is slowing down my app for these functions, especially for only 1 record.
I'm using the BindingNavigator controls to add, update, delete, etc.
PPOBindingSource.EndEdit()
PPOTableAdapter.Update(Me.DwCustomDataSetPPO.BenefitAdj_PPO)
Is there someway to over ride what Vb generated and create my own code for these functions?
The generated code is inefficient and convoluted.
Any help greatly appreciated.
Mike
|
|
|
|
|
I am trying to create a setup project that will upgrade certain .dlls that are only used by my project. The idea behind this is that only the required dlls need replacing as opposed to the whole application being re-installed.
The setup project I have created at present will not overwrite the dll but will install the updated one if I previously remove the old one manually.
I am not sure if this is the way to do it and would appreciate any help/advice on this matter
J
|
|
|
|
|
Hello,
I have a MDI-application in VB.NET. Now I want to show a dialogbox in it, but while the dialogbox is showing, it should not be possible to click on the other forms (eg. close parent-form of my MDI-application).
Can anyone tell me how to do this?
Thanks!
G72360
|
|
|
|
|
Call <a href="http://msdn2.microsoft.com/en-us/library/c7ykbedk(VS.80).aspx" rel="nofollow">ShowDialog</a>[<a href="http://msdn2.microsoft.com/en-us/library/c7ykbedk(VS.80).aspx" target="_blank" rel="nofollow" title="New Window">^</a>] on the new form instead of Show .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
------------Begin Update on my original question
I have been able to successfully store the attribute list in the TreeNode.Tag field in the AddNode function.
I have changed the line of code in AddNode function
inTreeNode.Text = inTreeNode.Text & " " & (attrNode.OuterXml).Trim
TO
inTreeNode.Tag = inTreeNode.Tag & " " & (attrNode.OuterXml).Trim
I do not see the Tag field displayed on the treeview though.
Then I changed the line of code in SaveScreenChangesToFile function
Else
StreamWriterForXml.Write("<" & currentTreeNode.Text & ">")
TO
Else
StreamWriterForXml.Write("<" & currentTreeNode.Text & " " & currentTreeNode.Tag & ">")
-- now I can save the attributes to an output.
But part of my original questions remains... how to display attributes in treeview? Do I HAVE TO populate the TreeNode.text field with attributes to see it? Which will have the effect of complicating my function when I go to write it out as a file. I will have to parse the TreeNode.text field more carefully.
-----------End Update on my original question
Hello,
I am having success with the following code in parsing element's attributes and displaying them in a treeview in visual studio 2003 in a vb.net application. However, when I go to save the treeview using the following code, I do not get any attributes. I am wondering if the way I am storing the attributes in the treeview is the problem. It seems you can display attributes in a treeview but they are still considered elements in a treeview structure. Below is the code I am using. By the way, when I only display elements in the treeview using the code below, there is no problem displaying or saving elements. It is only when I try to add the ability to display and save attributes that my trouble begins because I miss creating ending tags in the saved output and it just gets totally wierd for other things. I am sorry I am not explaining all the output problems when I try to deal with attributes. If anyone is able to shed some light, I will be glad to bore you with the details.
thanks.
tanya
BEGIN code that parses xmldocument into treeview
----- begin button subroutine that fires off reading xml from
------sql server and dumping it into a datatable, then read
------ datatable into an xmldocument
Private Sub ButtonUseThisQuotNumber_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonUseThisQuotNumber.Click
PopulateDataSetWithXml(ComboBoxHelper.Text)
ButtonUseThisQuotNumber.Visible = False
DisplayXmlInTreeView()
TreeViewForXml.Visible = True
End Sub
----------BEGIN SUBSET of PopulateDataSetWithXml procedure used
Try
SQLCommandForQuery = "Select XMLData from webuser.WEB_ORDER_XML where Quote_Num = '" & nQuoteNum & "'"
Dim SqlDataAdapterForPopulateDataTable As New SqlDataAdapter(SQLCommandForQuery, DummyString)
SqlDataAdapterForPopulateDataTable.Fill(DataSetOfData, "TableOfData")
SqlDataAdapterForPopulateDataTable.Dispose()
Dim RowOfData As DataRow = DataSetOfData.Tables(0).Rows(0)
' just for fun I found out it is 42,000+ characters
i = RowOfData(0).ToString.Length
Dim XmlDoc As New Xml.XmlDocument
XmlDoc.LoadXml(RowOfData(0).ToString)
Dim AnXmlNode As XmlNode
AnXmlNode = XmlDoc.DocumentElement
Catch ee As Exception
MsgBox(ee.ToString)
End Try
----------END SUBSET of PopulateDataSetWithXml procedure used
Public Sub DisplayXmlInTreeView()
Dim showAttributes As DialogResult
Try
' SECTION 1. Create a DOM Document and load the XML data into it.
Dim RowOfDataForTreeView As DataRow = DataSetOfData.Tables(0).Rows(0)
domForTreeView.LoadXml(RowOfDataForTreeView(0).ToString)
showAttributes = MessageBox.Show("Do you want attributes displayed?", _
"Attributes in Treeview", MessageBoxButtons.YesNo)
If showAttributes = DialogResult.Yes Then
displayAttributesFlag = True
Else
displayAttributesFlag = False
End If
' SECTION 2. Initialize the treeview control.
TreeViewForXml.Nodes.Clear()
TreeViewForXml.Nodes.Add(New TreeNode(domForTreeView.DocumentElement.Name))
Dim tNode As New TreeNode
tNode = TreeViewForXml.Nodes(0)
' SECTION 3. Populate the TreeView with the DOM nodes.
AddNode(domForTreeView.DocumentElement, tNode)
TreeViewForXml.ExpandAll()
Catch xmlEx As XmlException
MessageBox.Show(xmlEx.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub AddNode(ByRef inXmlNode As XmlNode, ByRef inTreeNode As TreeNode)
Dim xNode, attrNode As XmlNode
Dim tNode As TreeNode
Dim nodeList As XmlNodeList
Dim i, j As Integer
Dim dumb As String
'Dim attributes As XmlAttributeCollection
' Loop through the XML nodes until the leaf is reached.
' Add the nodes to the TreeView during the looping process.
If inXmlNode.HasChildNodes() Then
nodeList = inXmlNode.ChildNodes
If (displayAttributesFlag = True) Then
If inXmlNode.NodeType = XmlNodeType.Element Then
If inXmlNode.Attributes.Count > 0 Then
' attributes = inXmlNode.Attributes
'dumb = attributes.Item(0).OuterXml
For j = 0 To inXmlNode.Attributes.Count - 1
attrNode = inXmlNode.Attributes(j)
inTreeNode.Text = inTreeNode.Text & " " & (attrNode.OuterXml).Trim
Next
End If
End If
End If
For i = 0 To nodeList.Count - 1
xNode = inXmlNode.ChildNodes(i)
inTreeNode.Nodes.Add(New TreeNode(xNode.Name))
tNode = inTreeNode.Nodes(i)
AddNode(xNode, tNode)
Next
Else
' Here you need to pull the data from the XmlNode based on the
' type of node, whether attribute values are required, and so forth.
inTreeNode.Text = (inXmlNode.OuterXml).Trim
End If
End Sub
END code that parses xmldocument into treeview
---------BEGIN code that reads the treeview into a file
Private Sub ButtonSaveScreenChangesToFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveScreenChangesToFile.Click
Dim parentNode As TreeNode
Dim testString As String
Dim xxx As Integer
'get the parent node
parentNode = TreeViewForXml.Nodes(0)
xxx = parentNode.GetNodeCount(True)
MsgBox(parentNode.Text & " has " & xxx & " nodes")
StreamWriterForXml = New StreamWriter("c:\xmlTestOutput.xml")
StreamWriterForXml.Write("<" & parentNode.Text & ">")
SaveScreenChangesToFile(parentNode)
StreamWriterForXml.Close()
MsgBox("Saved output to c:\xmlTestOutput.xml")
End Sub
Private Sub SaveScreenChangesToFile(ByVal nodePassedIn As TreeNode)
Dim tNode As TreeNode
Dim ie As IEnumerator
Dim nodeLabel As String
ie = nodePassedIn.Nodes.GetEnumerator()
nodeLabel = nodePassedIn.Text
While ie.MoveNext()
Dim currentTreeNode As TreeNode
currentTreeNode = ie.Current
If currentTreeNode.GetNodeCount(True) = 0 Then
'this node has no children to parse
StreamWriterForXml.Write(currentTreeNode.Text)
StreamWriterForXml.WriteLine("")
Else
StreamWriterForXml.Write("<" & currentTreeNode.Text & ">")
End If
If currentTreeNode.GetNodeCount(True) > 0 Then
'this node has children to parse, recursively call this program
SaveScreenChangesToFile(currentTreeNode)
End If
End While
StreamWriterForXml.Write("")
StreamWriterForXml.WriteLine("")
End Sub
----------END code that reads the treeview into a file
-- modified at 10:32 Monday 24th April, 2006
|
|
|
|
|
hi
i'm making a simple program in which i have textbox and a button.
what i want is that when i click on the button its shows me a text of textbox in a message box.
i have initialized a textbox in pageload.....
code is:-
for button
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(TextBox1.Text)
End Sub
in page load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Text = "Amit"
end sub
when i run this it always shows me the "Amit".
however i change the value of textbox it show me "Amit".
plz tell me where i'm wrong.
|
|
|
|
|
Looks like your Page_Load() event is being fired every time. Check your other code to see what's happening.
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
thanx
i haven't use ispostback false that is why i was getting th same value.
byeeeee
|
|
|
|