|
Hello, I have to create a small program that allows a Check box that controls a label message on aother form to show a message when the box is checked, the label is on Form1 and the radio button is on Form2.
But I dont know how to get a Check box to control something on another form, Any help would be great thank!
(Im using Visual Basic.net 2002 on Windows XP)
-- modified at 7:51 Thursday 4th January, 2007
|
|
|
|
|
In the CheckedChanged event of you check box, use an If statement to detect the check state of the check box. Then, (depending on the check state), change the label.
For example:
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
Form2.MyLabel.Text = "Checked"
Else
Form2.MyLabel.Text = "Unchecked"
End If
End Sub
Hope this helps.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Thank you for this solution!
|
|
|
|
|
Sir/Madam,
I am facing the problem in the query implementation in vb.net.Like I have an id that is present in 5 tables(like table1,table2,table3,table4,table5).I have to pick those records from table1 which are not present in tabl15.I mean an id number 1 is present in table1,table2,table3,table4 .but the id number 1 is not present in table5.My final motive is i have to pick all the id like 1.
i am using the query in the following way.
dim str as string = "Select able1.field1,table2.field1,table3.field1,table4.field1
from table1,table2,table3,table4,table5
where
(table1.id<>table5.id and table2.id <> table5.id and table3.id <> table5.id
and table4.id<> table5.id)
it is showing those records that are not present in table5 but present in the remaining tables.
But the problem is , there occured duplicacy.I mean one record is iterating 24 times i the final result.
Please help.
Thanks and Regards
Pankaj
|
|
|
|
|
Hi Guys,
Happy new year everyone!!!
Resolution I: Reduce number of all-nighters from 366 to 365
Resolution II: Reduce coffee consumption from 700lt to 700lt – ½ cup
Anywho…back to the problem. I was trying to think of a simple solution for auto-patch/upgrade engine for one of my last projects. Obviously didn't go very far.
If any one has some ideas or links to point me in the right direction I would really appreciate it.
Thanking in advance
Happy Coding
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Anyone?
The perfect code is always in your head...it just a matter of how hard you bang your head against the wall to get it out!
|
|
|
|
|
Alex Feature wrote: If any one has some ideas or links to point me in the right direction I would really appreciate it.
Wasn't Click Once deployment developed for this purpose? Hmm I think there might also be some features for auto updating as part of MSI installers.
If neither of those two options will work then take a look at this thread, while it’s a different language the concepts are still the same.
Compiled help from the LAN[^]
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi,
Any one have an idea about counting total records in a reader.
Thanks,
|
|
|
|
|
pathak78 wrote: Any one have an idea about counting total records in a reader.
Read all the rows out counting as you go. There is no method for giving you a count ahead of time.
|
|
|
|
|
Just had another thought. You can send the query SELECT COUNT(*) FROM .... to the datbase followed by the query where you replace COUNT(*) with the columns that you actually want. That way the first result set out of the Data Reader will contain the count. Remember to put both in a transaction so that the count does not change between queries as it is possible another process could sneak in and insert or delete a row in the table you are selecting from.
|
|
|
|
|
|
Hi,
I am trying to write a wrapper for the DAAB in Ent Lib 2.0 since I have to use MS Access.
As usual, I am facing hurdles right at the start. When I try to return the data reader from the wrapper class, I get the error "connection not initialised". I am using the Generic Database class. The relevant code is posted below:
Dim objCommand As DbCommand
Try
Dim db As Microsoft.Practices.EnterpriseLibrary.Data.Database
db = New GenericDatabase(ConnectionString, DBProvider)
'db.CreateConnection.Open()
objCommand = db.GetSqlStringCommand(strSQL)
error here --> Dim dr As IDataReader = objCommand.ExecuteReader()
'Dim dr As IDataReader = db.ExecuteReader(strSQL)
Return dr
I get the error:
Connection property has not been initialised.
I have tried with opening the connection, getting the datareader directly etc., but still the same error. And yes, the connectionstring is correct. The provider I am using is OleDB.OledBFactory.Instance.
Any help/guidance on this is really appreciated.
Shreekar
|
|
|
|
|
shreekar wrote: Dim dr As IDataReader = db.ExecuteReader(strSQL)
Try
<br />
Dim dr As IDataReader = db.ExecuteReader(objCommand)<br />
|
|
|
|
|
Thanks a lot!!!
I guess I was looking at the code too hard...
But there is something nagging me at the back of my mind.
I think I will test more and respond.
Thanks again.
Shreekar
|
|
|
|
|
Hi .
I've managed to create a printing method and at the moment i'm using hardcoded margins. i need advice on things i've noticed which
1. print preview is aligned where as print out is only slightly off.
can u give me advice on what to code for e.g. do i need to simply add pagesettings dialog to manipulate margins or should i get real printer hardware margins and use them. what is the pro way to do this and the best way.
perhaps you can also be kind enough to show me a source example aswell.
Robbo
|
|
|
|
|
I have created a class in my project in a seperate file to the main form. When I try to use the maths class functions in this class such as Math.Abs(x) I get a build error message " Name 'Math' is not declared" but when I use the same function in the main form I have no problem with using it. Can anyone help?
|
|
|
|
|
use System.Math.Abs(x)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am trying to make a note card program, can someone help me out? I need help making the program, i would like it to have a form with a textbox for a word, definition, sentence, and a synonym. And users should be able to add words and save lists from the initial form. Then when they click a study button, another form should open up, and it should randomly select a word from the list and show them only the word. Next, when they click Flip! they should see the definition, sentence, and synonym. I will post what i have so far, but my vb skills are a bit rusty, so if someone could help me, it would be appreciated. http://www.mediafire.com/?enkqyoyzwzy
|
|
|
|
|
IMHO, What do you really need is a good VB tutorial.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Alright, update, can someone tell me why this doesn't work, (don't worry, the layout will change, i have it like this for testing). I suspect that the problem is in the part where it saves the cards.
Public Class Form1<br />
Dim mode As Integer<br />
Dim words(30) As String<br />
Dim definitions(30) As String<br />
Dim synonyms(30) As String<br />
Dim sentences(30) As String<br />
Dim rotation As Integer<br />
Dim temp As String<br />
Dim Wordnumber As Integer<br />
<br />
Private Sub CreateCard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateCard.Click<br />
mode = 1<br />
Wordnumber = 1<br />
Label1.Text = "Card Created"<br />
temp = Word.Text<br />
words(Wordnumber) = temp<br />
temp = Def.Text<br />
definitions(Wordnumber) = temp<br />
temp = Sentence.Text<br />
sentences(Wordnumber) = temp<br />
temp = Syn.Text<br />
synonyms(Wordnumber) = temp<br />
Wordnumber = Wordnumber + 1<br />
End Sub
or in the part where it recycles the words when it reaches a blank one
<br />
Private Sub flipcard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Flipcard.Click<br />
synstudymode.Text = synonyms(rotation)<br />
sentencestudymode.Text = sentences(rotation)<br />
defstudymode.Text = sentences(rotation)<br />
wordstudymode.Text = words(rotation)<br />
If words(rotation) = "" Then<br />
wordstudymode.Text = "You have completed one rotation."<br />
rotation = 1<br />
End If<br />
rotation = rotation + 1<br />
End Sub<br />
I have posted the entire source at:
http://www.mediafire.com/?9n42k3mj3rz
-- modified at 19:59 Thursday 4th January, 2007
|
|
|
|
|
Hello All,
I have a project I am currently working on using VB .NET and VS 2005. Basically one of my classes maintains a collection of various objects all derived from a base class, but different. I want each of these derived classes to have a common method, but the paramaters for the method will vary.
Example, here is a cut down version of the base class and derived classes and what I want them to do.
Class clsString
public mustoveride sub AddPoint(index as integer, pnt as clsPnt)
End class
Here are some versions of the derived classes.
Class clsString3D
inherits clsString
public overrides sub AddPoint(index as integer, pnt as cls3d)
'do some other stuff here
End class
Class clsString6D
inherits clsString
public overrides sub AddPoint(index as integer, pnt as cls6d)
'do some other stuff here
End class
My program returns the object in this manner
Public function getString(byref name as string) as clsstring
getstring=string.item(name)
end function
I then call the function like this
Dim STR as clsstring
dim P6 as new cls6D
p6.setvals(5,7,34.6,45,3)
str=MDL.getString("MC01") 'this would in a working version return a string of clString6D
Str.AddPoint(4, P6)
Now I realise that you cannot override the function if the function signature is not the same, but shadowing doesn't seem to work either. Could someone please explain to me correct way for me to code what I want to do, or even if it is possible.
Regards,
Martin Duke
|
|
|
|
|
Aren't you able to deal polimorphically with pnt also?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello,
Yes, you're right, because all the point classes derive from a base class, clsPnt, I can, that solves my problem, thank you for your help.
Kindest regards,
Martin.
|
|
|
|
|
I need to format the date when the values are inserted to the MySQl db. All other columns work fine but all of the date columns are inserted as zeroes and in a different format, for example 0000-00-00. Any ideas?
Code:
Dim myConnString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=192.168.1.27;" & _
"DATABASE=testship;" & _
"USER=;" & _
"PASSWORD=;" & _
"OPTION=3;"
Dim MyConnection As New Odbc.OdbcConnection(myConnString)
MyConnection.Open()
Dim MyCommand As New Odbc.OdbcCommand
MyCommand.Connection = MyConnection
MyCommand.CommandText = "INSERT INTO ls_orderitems (OrderDate, OrderCustomer, OrderAcctNum, OrderType, OrderSoNum, OrderItemPartNum, OrderItemPartDesc, OrderItemQty, OrderItemQtyRec, OrderItemQtyDtRec, OrderItemBO, OrderItemBODt,OrderItemCanceled, OrderItemCanceledDt, OrderItemNotes, OrderItemPONum, OrderItemRetailPrice, OrderItemSalePrice, Status, InsertDate) VALUES ('" & OrderDate & "','" & OrderCustomer & "','" & OrderAcctNum & "','" & OrderType & "','" & OrderSoNum & "','" & OrderItemPartNum & "','" & OrderItemPartDesc & "','" & OrderItemQty & "','" & OrderItemQtyRec & "','" & OrderItemQtyDtRec & "','" & OrderItemBO & "','" & OrderItemBODt & "','" & OrderItemCanceled & "','" & OrderItemCanceledDt & "','" & OrderItemNotes & "','" & OrderItemPONum & "','" & OrderItemRetailPrice & "','" & OrderItemSalePrice & "','" & Status & "','" & InsertDate & "'" & ")" '& "','" & 'TimeStamp & "'" & ")"
MyCommand.ExecuteNonQuery()
MyConnection.Close()
|
|
|
|
|
Change this to a parameterized query. The parameter objects take care of the translation for you. You can read why they are a good thing here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|