|
So, please help, i want to make application FTP, but i dont know how to do, give me a example.
Sohceat
................
|
|
|
|
|
Hi all,
I have 30 buttons and 1 textbox. When i click button, button's text will be displayed in textbox. It means i must write event for each button and i have 30 functions for 30 buttons. That's too long.
So how could i solve that by 1 function? (it means when 1 click a button, program will detect which button was clicked and get that button's text )
|
|
|
|
|
ctlqt12 wrote: It means i must write event for each button and i have 30 functions for 30 buttons.
No, it doesn't. The sender property on an event is the control that raised it. So, write one event that casts that to a Button, grabs the text and sets it to the textbox.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Have you noticed the Handles clause at the end of the method header for a button click??
Private Sub Button1_Click(blah, blah,) Handles Button1.Click
Well, you can tack on as many buttons as you want like this:
Private Sub Button1_Click(blah, blah,) Handles Button1.Click, Button2.Click, Button3.Click, ...
|
|
|
|
|
Hey..
What did you mean by a button's TEXT??
The name is Sandeep
|
|
|
|
|
after tagging the events as Dave Kreskowiak told with the handler
detect the particular button
dim b a button = ctype(sender,button)
select case b.name
case ""
.....
end select
|
|
|
|
|
use follwing code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, ...Button30.Click
textbox1.text=sender.text '(or textbox1.text=textbox1.text & sender.text)
end sub
Hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Hi,
In which language are you writing the code for this? vb or vb.net? If in case of classic vb, use buttons as control array and write a single function. if in case of vb.net, write a event as follows :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button5.Click, Button4.Click, Button3.Click, Button2.Click<br />
Dim kBtn As Button<br />
kBtn = sender<br />
TextBox1.Text = kBtn.Text<br />
End Sub
Here you can use the source button's properties using kBtn variable.
Thanks,
Kiran Kumar
|
|
|
|
|
Problem:
When i fetch a list of column values from database and store them into a String One dimentional Array, it gives me exception error "Null Reference", kindly can anyone help me out, whats wrong with my code?
<br />
<br />
myProfileNames.SetValue(pfDataSet.Tables("TimerDetails").Rows(j).Item("ProfileName").ToString, j)<br />
<br />
MsgBox(myProfileNames.GetValue(j))<br />
<br />
<br />
Code:
Public Class DataAccess
Private m_strAppPath As String
Private m_connectionString As String
Public m_connectionObject As New OleDbConnection
Private dataAdapter As OleDbDataAdapter
Private pfDataSet As DataSet
// One Dimentional Array to hold String Values fetched from Database...
Public myProfileNames() As String
// Public Subroutine that will be called through an instance of this
// class.
Public Sub LoadProfiles()
Dim ProfileCount As Integer
m_strAppPath = Directory.GetCurrentDirectory
m_connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & m_strAppPath & "\TimerData.mdb"
Try
If Not (m_connectionObject.State = ConnectionState.Open) Then
m_connectionObject.ConnectionString = m_connectionString
m_connectionObject.Open()
m_ConnectionStatus = True
End If
dataAdapter = New OleDbDataAdapter("Select * from ProfileMaster", m_connectionObject)
pfDataSet = New DataSet("TimerDetails")
dataAdapter.Fill(pfDataSet, "TimerDetails")
// GET the No. of Rows that exists in Dataset
ProfileCount = pfDataSet.Tables("TimerDetails").Rows.Count
If Not (ProfileCount = 0) Then
Dim j As Integer
For j = 0 To (ProfileCount - 1)
// =========================================================================
// This is Where Problem comes Stating that Null Refrence Exception occured
// =========================================================================
myProfileNames.SetValue(pfDataSet.Tables("TimerDetails").Rows(j).Item("ProfileName").ToString, j)
MsgBox(myProfileNames.GetValue(j))
// =========================================================================
Next
End If
Catch ex As Exception
MsgBox(ex.ToString)
Finally
If m_connectionObject.State = ConnectionState.Open Then
m_connectionObject.Close()
End If
End Try
End Sub
End Class
-- modified at 14:53 Monday 28th May, 2007
:- Rashid Ali -:
|
|
|
|
|
It seems to be that the result doesn't have a field named "ProfileName". Do you have such a field in the table?
Specify the fields that you want returned in the query, instead of using *. That makes debugging easier, plus it makes the query only fetch the data that you need.
---
single minded; short sighted; long gone;
|
|
|
|
|
Friends, i got ma problem fixed
// One Dimentional Array to hold String Values fetched from Database...
Public myProfileNames() As String <-- Wrong Initialization
public myprofileNames(10) as String <-- Problem Solved:-D
But i still want to know, what if i dont know, how mnay elements my array gona contain, how to dynamically initialize array elements.
anyone there for help?
:- Rashid Ali -:
|
|
|
|
|
That's what classes like List ( or ArrayList in .NET 1.0 and 1.1 ) are for.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I need to disable a tabpage in a tabcontrol.
I 've tried to set the property "Enabled" to FALSE, but it doesn't shadow the text.
So I tried to set the forecolor property of the tabpage, but it doesn't work.
Finally I tried to draw each item by code as Microsoft suggests(through the drawitem event), but the result is really ugly (it losts the visual effects and the text doesn't fit in the bounds).
I cannot remove and re-add the pages for 2 reasons:
1) Each page could be enabled or disabled depending on several values in the form, so it is difficult to re-add the page in the right place
2) I LIKE the behaviour of old VB6 tabcontrol.
Can anyone help me ???
Thanx a lot.
Peace!
|
|
|
|
|
You two choices. One is to draw the tabs yourself, fixing your drawing code. I wish I had some examples to give you but I just about never use the TabControl, except in an Options dialog.
The other is to find a 3rd party TabControl that supports the visual effects you want. I don't know of any off the top of my head, well, because I just about never use the TabControl.
|
|
|
|
|
Hello
Try this that at the event of paint event of your tab page set its focus to some other or next object.
Example:
Private Sub tabpage1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles tabpage1.Paint
tabpage2.Selected = True
End Sub
Regards
Ali Raza
|
|
|
|
|
Nice idea, the controls inside the page don't respond anymore.
This can be obtained (with grayed controls) also by setting the property enabled of the tabpage...
But doesn't resolve the problem of graying the tabpage title.
Thanks, anyway.
For other friends: the command is TabPage2.Select (is a method, not a property).
Regards,
Advansis
Peace!
|
|
|
|
|
Hello. I need to activate a Timer control from other thread, so I think I have to use the Invoke method. As Timer don't have the InvokeRequired property as buttons and other controls, how can I do that?
Regards,
Diego F.
|
|
|
|
|
You create a method on your form that sets whatever you need on the Timer control. You can check the InvokeRequired of the form instead of the Timer control. Since the form's based Timer works on the UI thread, the Form is on the same UI thread and will tell you if InvokeRequired.
You Invoke the method you write from your other thread...
|
|
|
|
|
Hello,
I am working on VB.net form based application. I am having one user conrtol on the main form with some context menu item on it. All the handlers of these context menu items are implemented in the user control.
I want to implement all these context menu items on the main Menu of the main form. Now i want to call the same handlers of the context menu from my main menu.
How should i invoke the handlers form other class?
thanks in advance.
gajesh
|
|
|
|
|
the handler in the control should be like this:
public overridable sub .....handler....
or
protected overridable sub .....handler....
and in the form u can call them like this:
public overrides sub ....handler....
...or u can make a public event in the control
...or make them all public and handle their events directly in your form
A.E.K
|
|
|
|
|
'Start Word and open the document template.
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add
oDoc.PageSetup.Orientation = wdOrientLandscape
oDoc.PageSetup.LeftMargin = 10
oDoc.PageSetup.RightMargin = 10
oDoc.PageSetup.TopMargin = 30
'Insert a paragraph at the beginning of the document.
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Diamant Drilling Services Run Report"
oPara1.Range.Font.Name = "Arial Rounded MT Bold"
oPara1.Range.Font.Color = wdColorBlue
oPara1.Range.Font.Size = 28
oPara1.Range.Font.Bold = False
oPara1.Range.InsertParagraphAfter
oPara1.Range.InsertParagraphAfter
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "QDC"
oPara1.Range.Font.Name = "Arial"
oPara1.Range.Font.Color = wdColorBlue
oPara1.Range.Font.Size = 8
oPara1.Range.Font.Bold = True
Ok, there is the code that opens word, opens a new document and starts to insert some things into it. my problem begins with the last block of code. once it has written the word "QDC", how do i then write another word after it on the same line without overwriting the "QDC"
I am extracting info from a database and the recordset is going to be used to populate the document. So you will have the following senario:-
QDC TYPE NUMBER
SPH423 PDC S6L1543
the second line contains the data that is extracted from the database and has to be inserted under the relevent "column headings". there might be only one record or there might be over 200, depends on what the user has searched for.
Any ideas on how to do this guys?
|
|
|
|
|
Use the InsertAfter method. It'll move the insertion point to the end
of the insert text, ready for your next insertion. You can also use
TypeText but can't remember whether that moves the insertion point or not.
Some similar to...
Set oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Selection.InsertAfter "QDC"
|
|
|
|
|
Hi! All,
I have to create CSV file using data of a table. Can anybody help me on this issue?
Thanks and Regards,
Virendra
|
|
|
|
|
You forgot to say VB6 this time. VB6 is a dead language, people will assume .NET unless you say otherwise.
Which bit can't you do ? Do you have the data from the table ? Do you know how to create a file ? If you broke this into it's three obvious parts and googled, I'm sure you'd find the help you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi i am trying to read the following xml file
<sessionrequest schemalocation="\WEB-INF\xml\schema\Application.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requesttype>APPLICATION
<token>
<requestarguments>
<application>
<companyid>TT0010001
<requesttype>APPLICATION
<application>FUNDS.TRANSFER
<version>,BM
<function>I
<operation>PROCESS
<transactionid>NEW<compscreen>MAIN
<message>
<field>
<fieldname>TRANSACTION.TYPE
<value>AC
<field>
<fieldname>DEBIT.ACCT.NO
<value>0110000020000005
<field>
<fieldname>DEBIT.CURRENCY
<value>USD
<field>
<fieldname>DEBIT.AMOUNT
<value>78
using the following code
Dim readx As XmlReader = XmlReader.Create("C:\Documents and Settings\gurubala\Desktop\1-1.t24txn.xml")
While readx.Read
If readx.NodeType = XmlNodeType.Element Then
MsgBox(readx.Name.ToString & " : " & readx.ReadString)
End If
End While
the problem here is it reads the nodes and values but starts to skip firstnode <message><field> ... it leaves <fieldname> element and reads <value>
why this happens how to avoid this
thanks
with regards
Balagurunathan.B
|
|
|
|