|
Many thanks now it works
|
|
|
|
|
In visual basic 2008 express edition
I need the code for a button that when clicked sends the text in that button to the selected window
Thanks in advance
Jamie
|
|
|
|
|
Noone is going to just hand you the code.
You don't have the Windows Internal's knowledge to pull this off. It's not as simple as clicking a button and calling SendKeys. Do you think you have the skill to have a button on your form clicked successfully without your window having the input focus?? Do you know what the "input focus" is??
|
|
|
|
|
Hello,
I am trying to do the following:
Private Sub GetDepartmentTest()
Dim myDataset As New DataSet("Databasename")
'load data from xml file
myDataset.ReadXml("C:\XmlDatabase\Data.xml")
Dim myDataRow As DataRow = myDataset.Tables("Department").Rows(0)
' the next line gives an error
Dim myDepartment As Department= myDataRow
MsgBox(myDepartment .Name)
End Sub
Class Department
Inherits Data.DataRow
Public Sub New(ByVal builder As DataRowBuilder)
MyBase.New(builder)
End Sub
Property Name() As String
Get
Return Item("name")
End Get
Set(ByVal value As String)
Item("name") = value
End Set
End Property
End Class
But I keep getting an error:
<br />
System.InvalidCastException was unhandled<br />
Message="Unable to cast object of type 'System.Data.DataRow' to type 'Department'." <br />
The error occurs on this line:
Dim myDepartment As Department= myDataRow
Can someone tell me what I do wrong?
|
|
|
|
|
You are mixing you data types.
You need a property for each field in the table
You need a private var for each field
then you can populate the object
Private Overloads Sub RowToObject(ByVal oTable As DataTable)<br />
If (IsNothing(oTable) OrElse oTable.Rows.Count = 0) Then 'no table not row then empty the object<br />
mvPFClassID = Nothing<br />
mvPFClass = Nothing<br />
mvModified = Nothing<br />
mvModifiedBy = Nothing<br />
Else<br />
Dim oRow As DataRow = oTable.Rows(0)'get the first row from the table<br />
mvPFClassID = IIf(IsDBNull(oRow("PFClassID")), 0, oRow("PFClassID"))'load the properties via the private vars<br />
mvPFClass = oRow("PFClass") & ""<br />
mvModified = IIf(IsDBNull(oRow("Modified")), Nothing, oRow("Modified"))<br />
mvModifiedBy = oRow("ModifiedBy") & ""<br />
End If
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
HI fnds,
I want to transfer and recieve an Image through serial port..
plz help me the code in VB.net
Thanks and Regards,
Ramesh Morasa
|
|
|
|
|
Open Image file in Binary mode and send it through serial port.
and receive also in Binary mode.
put your serial port encoding to UTF-8
use this for put UTF-8 Encoding
SerialPort1.Encoding = System.Text.Encoding.GetEncoding(1252)
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Please read the forum guidelines; your posts should have more meaningful titles.
|
|
|
|
|
I am almost a complete beguinner in visual basic
I want to create a program that can insert accented letters into any microsoft program (word, notepad)so that when you press a button with an accented e that will come up on your work (i worte on screen keyboard on the top because i didnt know what this would be called) i want my program to be on top of all other programs. I need alot of help with the code though!! Thanks in advance
Jamie
please email me with any solutions at jamiepascoe@hotmail.com
|
|
|
|
|
There is an on screen keyboard CP article. Getting it to work between apps, is probably a little complex for you right now.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I do love an understatement!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Oy thats not fair, i bet sometime you were a beguinner aswell
Anyway i have looked at all the links and i cant find anyhting that is what i want, i just want the code so that when you press a button the text in that button is sent to the selected window(application) somebody please help me
thanks in advance
Jamie
|
|
|
|
|
In order to press a button in one application, it needs to have the input focus. Since your keyboard now has the focus, what was the last control to have the focus??? Hint: There's no function or method that will tell you that. So where do you send the key stroke??
|
|
|
|
|
Please help me i've seen it done before i just dont know how to code it in i think possibly you could set it so when a button is pressed it opens a microsoft word document and then all the other buttons simply Word.Application = Word.Application & button1.Text but word. Application does not seem to work in vb 2008 express edition.
Can no one help me
Please
|
|
|
|
|
This should be a softball for some of you.
I want to have all of the text in a textbox highlighted when I enter (click, tab, etc) into it. How do you do that?
Thanks in advance!
|
|
|
|
|
Use the selectionstart and selectionlength properties, set them to 0 and the length property of the text.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
TextBox.SelectAll()
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Create a handler for the GotFocus event & use SelectAll method. This works for tabbing between controls. Select all on click is a difficult, because the control uses mouseDown to set the caret. You could handle the MouseDown event in the same way as GotFocus & see if you like the result.
Rob
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Hi every body ,
i have a problem ??
i have a list view control in windows application , and i set its chcek property to true
i want if the user Check an item to make all other items unchecek and i don't know how ? i try too much but it doesnot work
Can You help me how to do it ??
Thanks
Mona .
LA ELAH ELA ALLAH MOHAMED RASOL ALLAH
|
|
|
|
|
You'd have to handle the ItemChecked event of the ListView, which will give you the item that was clicked on. You'd then have to set a static flag in the event handler that will signal that you are changing check marks. Iterate over the items in the list, changing each check mark, then reset the flag. Since changing the check mark will fire the same event again, the handler code has to start by check that flag. If it's set, then the handler code can exit without making any changes.
But, wouldn't this be a job for RadioButtons?? After all, this is exactly what they do.
|
|
|
|
|
thanks for your replay
but can you mak it more simple , sorry i am new in vb so can u explain with code , it'll be better and easy to understand
Thanks a lot
Mona
LA ELAH ELA ALLAH MOHAMED RASOL ALLAH
|
|
|
|
|
Hello,
Please try this code. I believe this should assist you.
<br />
Private Sub ListView1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck<br />
<br />
For i As Integer = 0 To Me.ListView1.Items.Count - 1<br />
<br />
If i <> e.Index Then<br />
<br />
Me.ListView1.Items(i).Checked = False<br />
<br />
End If<br />
<br />
Next<br />
<br />
End Sub<br />
<br />
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
or another one
<br />
If Bloading the exit sub<br />
bLoading = true<br />
For each oItem as Listview item in LVData.items<br />
oitem.checked = true<br />
next<br />
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sorry for my english...jejeje
i can't create my UserControl With opacity.
somebody knows like doing it?
I thank for your aid....
CODEPROJECT is my favorite WebSite.
thanks!!!
OrLaNdO HeRReRa
«« MEXICO »»
|
|
|
|
|
rammsteinohr wrote: i can't create my UserControl With opacity.
No, you can't. Opacity only applies to the entire form, not controls. Currently, you'd have to use WPF to do this.
|
|
|
|