|
Yes.
If you are using a BindingSource and all your controls are bound to it.
Have two DataSets one for StudentA and one for StudentB.
Then when you want to change simply:
myStudentBindingSource.DataSource = studentADataSet
OR
myStudentBindingSource.DataSource = studentBDataSet
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry that makes sense.
|
|
|
|
|
Here's an oddball question and somewhat hard to describe. I'd like to know how to recreate the lack of cell formatting that occurs when you open a new sheet. I notice that Excel applies a light-gray grid that isn't (apparently) part of the properties for the cells. If I change the border properties to, say, a rectangle around a cell and then want to remove that, I need to know how to reset the border property to reflect the pristine, no-property look of a brand-new sheet. If I reset the cells to the default property, say, LineStyle=xlNone, I get a range of pure white. If I specify xlThin, then I get a black grid, also not the pristine, "new" look of a new sheet. Obviously, I'm missing something here.
|
|
|
|
|
Have you tried the ClearFormats method? (Don't know if this exists in 2003 (i only have 2007))
e.g.;
Dim x As Worksheet
Set x = ThisWorkbook.ActiveSheet
x.Cells.Range("A1:F10").ClearFormats
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
I am new to vb.net and am having a problem getting data into a database
On a form I have a main database with dataset/bindingsouce/dataview with all of the students appearing correctly
Now ive created a new dataset/bindingsource/dataview which needs to be populated with other classtime information once a student is selected from the main database. Currently the code directs to the GetClassTime once a student is selected from the bindingsource.
HERE IS MY CODE
private sub GetClassTime()
Dim sQuery As String = ""
sQuery = "SELECT [Description],[Lesson], [Location], [StudentID], [CourseCode] From [ClassTime] Where ((([StudentID]) = " & Val(txtStudentID.Text) & ")) And (([CourseCode]) = " & Val(txtCourseCode.Text) & ") ORDER BY [Description];"
bindingsource_Classtime.DataSource = sQuery
Me.DataGridView_Classroom.DataSource = Me.BindingSource_Classtime
end sub
I dont get any errors but the datagridview_classroom is empty.
Can anybody please help?
Thanks in anticipation.
timark2000
|
|
|
|
|
You will need to execute your query. One way to do this is to use an SqlCommand instance. MSDN Page[^]
Then you can use the reader to load the data into a dataset. Example[^].
The resulting DataSet can then be used by your program like this.
bindingsource_Classtime.DataSource = myNewDataSet
For your future reference You should enclose your code between <pre lang="vb"> Your code goes here </pre>.
It makes it much easier to read.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry...much appreciated
You have replied bindingsource_classtime.datasource = mynewdataset
I have no clue on how to apply mynewdataset
Ive researched without success.
Hoping you can help
|
|
|
|
|
myNewDataSet is a made up name intended to represent the DataSet that you would have created in the step before if you followed the suggestions I made.
If you did follow the examples then the line would be
bindingsource_classtime.datasource = whateverYouCalledTheDataSetInTheStepBefore
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
why do you insist on providing only the last statement of the solution?
|
|
|
|
|
My Bad!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
It's been a while since I've used VB and I need help with understanding the truePart in the second line.
Dim asciiBytes As Byte() = Encoding.ASCII.GetBytes("SomeAsciiData")
Dim nextchar As Integer = IIf(asciiBytes.Length > (i + 1), asciiBytes.Length > (i + 1), -1)
How does asciiBytes.Length > (i + 1) return an integer?
|
|
|
|
|
In VB.NET an expression like
asciiBytes.Length > (i + 1)
will return a Boolean value - in this case True as it is identical to the Expression part of the IIf method. Internally, a Boolean value is stored as an integer (False -> 0, True -> -1), so the conversion to an integer is straightforward.
However, I think there' a bug in your code: it should probably read
Dim nextchar As Integer = IIf(asciiBytes.Length > (i + 1), asciiBytes(i + 1), -1)
in other words it returns the ASCII value (0 - 255) of the next character in the array if the Expression is True and -1 if it is False .
|
|
|
|
|
Thanks Geoff
I didn't write the code (but that line is working) - maybe the compiler converts the boolean to a 0 or 1 in the background.
I'll test it later
|
|
|
|
|
Correctly, true equals -1, and 0 equals to false. Perhaps it would be easier to just initialize the variable to -1?
I are Troll
|
|
|
|
|
Absolutely right.
(I incorrectly assumed that true would be 1 and not -1)
|
|
|
|
|
Dim query As ObjectSet(Of customer) = context.customers
Dim queryResult As ObjectResult(Of customer) = query.Execute(MergeOption.AppendOnly)
how do i get ddlcust.selectedvalue= queryResult.customerid
|
|
|
|
|
i am actually working on my final year project which is a pc-based fruit sorting system which involves computer vision.i am trying to use my program in vb to do all tasks involved.can you help me please?
|
|
|
|
|
Please understand that posting the same or similar question so often is considered spam.
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Typically the folks here will not do your homework for you. Everyone here is extremely helpful providing you do your own research first and when you get stuck, then post your question along with a detailed explanation and you will get a prompt response.
My suggestion is to do some research first (Google it), then come back when you get stuck.
Good luck.
|
|
|
|
|
Wait, you're serious? Wow, I thought the previous post was a joke... Who in their right mind would try to do all of that in VB6?
|
|
|
|
|
I understand you're new around here. Please stick to a single thread as long as you're on the same subject, so don't hit "New message" all the time, just hit "Reply" when you want to reply to something someone has answered to one of your earlier posts.
As I said before, VB6 is not the best choice, but I understand there may be reasons for that choice. It will limit the amount of useful reactions you may get. I for one don't have any VB6 code, program or tool around. Parallel ports are a bit ancient too, my systems don't have any. There used to be an "inout.dll" file that did some input/output magic, back in time when Windows still let you do anything you wanted; not sure that DLL would be acceptable to Win XP, I'm pretty sure Vista/Win7 will dislike it.
And then there is the matter of responsiveness. In my opinion Windows isn't capable of providing smooth steps to a stepping motor. It you wire it up, the result will be jerky and loud, as no pulse will have a reasonably accurate position or width. In order to control a stepper motor, you need a micro-controller (with or without a very simple kernel), and not a mighty CPU with a massive operating system that lacks real-time qualities.
|
|
|
|
|
Take a look on the coding4fun[^] blog; they've got a section on hardware-projects, being complete tutorials that could be inspiring.
Are you sure that your school accepts VB6?
I are Troll
|
|
|
|
|
First, I'd seriously question the quality of the school yuo're going to if they are still teaching in VB6.
Second, in order to get a stepper motor to work reliably, and allow your code to do other thing while the motor is turning, you need to go with dedicated hardware, like the stuff you find as Phidgets.com and TrossenRobotics.com.
If you tried to do this in your VB6 code, you'd be able to turn one motor only and do nothing else until your code stopped the motor.
|
|
|
|
|
i am actually working on my final year project which is a pc-based fruit sorting system which involves computer vision.i am trying to use my program in vb to do all tasks involved.can you help me please?
|
|
|
|
|
VB6... Gotta mention that it's VB6... Otherwise you ruin the joke
|
|
|
|