|
It worked finally ! And the last question. In dataAdapter I used "select * from student" and I filled them in datatable which names Table. Table is used for datagrid's source. But I don't want to display classID column in datagrid, what should I do ? Thank you very much for your help so far !
|
|
|
|
|
No problem, I am glad to hear it works.
If you want to filter out certain columns from view, you will have to use the Data Grid's TableStyles property (form designer > datagrid's properties > 4th from the bottom usually).
With this property you can put a "mask" between the table and the datagrid. Just add a table to the TableStyle and use its MappingName property to map it to your table.
To the TableStyle table you just created, you add GridColumnStyles (usually 3rd from the bottom). Just add a column here for each column you want to show, and map each column to the appropriate column in your table.
With GridColumnStyles, if you like, you can then also determine column width, alternating row color, etc.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks again ! Could you write commandline like this
dim TableStyle as new datagridTableStyles
etc.
I have read the example in MSDN. But I couldn't write the code.
|
|
|
|
|
It is indeed possible to make these TableStyles, etc, at runtime, but it is just far easier to do it in the designer. For the same reason I have no experience with implementing TableStyles at runtime myself.
If you really must do it that way, I suggest that you experiment a little bit, and if necessary, post an entirely new question on this board. Maybe someone else can help you with it.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I have made it work on my own. But thank you anyway ! I've just read your signature and I think I'm a lucky man. I'm just a university student and I have nothing to pay you . Would you like to make friend with me ? Here is my email cotinhkhongtin@yahoo.com .
|
|
|
|
|
I got new problem here. StudentID is the primary key of the datatable Student. I don't want to display this column on datagrid. When I finish editing a row and click to other row on datagrid, error mesage appears "StudentID is not allowed null". I use a function name CreateKey to create the value of StudentID. I put the function CreateKey on the CurrentCellChanges event but it didn't work. Can you help me ?
-- modified at 10:22 Wednesday 14th February, 2007
|
|
|
|
|
Hi Bircut,
I have a feeling that maybe you need to look at the structure of the application, and not so much at where to place your function. What I mean is this:
Let's say that after you have created your Classroom ID, you want to add students to the classroom.
First you need to create the students in their own table. We can safely assume that this will be done by an administrator, who is allowed to see the Student ID (you don't have to hide it here). So you make a form in which the admin can add, delete and change students (all the students in the entire school). Your CreateKey function can be implemented here somewhere, because you want a unique ID for each student.
Next you can make an 'Add Student' Button and a ComboBox (for example) that you bind to the Students table. From this ComboBox you can then select a student from the Student Table, and add it to the Classroom Table with the Button. Something along the lines of:
<br />
'Button_Click Event:<br />
'Determine correct record from Student table based on Student name (for example)<br />
Dim StudentName as String<br />
StudentName = ComboBox.SelectedItem<br />
SQL_string = "Select * From Students Where Students.StudentName = '" & StudentName & "'"<br />
To the DataGrid that shows the students in the classroom, you then add a TableStyle, and GridColumnStyles only for the columns you want to show.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I undertood your method and I had thought about this before. But my professor didn't agree. I also thought about using autonumber type to make the value. But I tried to use the function CreateKey because the character in StudentID have their meaning, I want to manage them. But I don't have time to think about it anymore. I need to finish this project before March. So I let the Administrator chose the value of StudentID finally. And one more thing, my project didn't mention about Student and Class. I tried to make thing easy to understand and someone could help me. Thanks again !!!
|
|
|
|
|
Sorry Guys/Ladies... this is a really basic question and you will probably scoff and laugh... I haven’t done any coding in 10 years much less any in VB.Net.
My question is related to a form I have built to return values from a directory. I need the box populated with the file names from a given directory and then populate the second combo box with the selected field in the first combo box...
Sorry for such a basic question, but if possible please help??
|
|
|
|
|
System.IO.Directory.GetAllFiles ( from memory ) will return the filenames. You can use an array as a data source for a control.
The combo has a selected index changed event, you can use this to pass data to the second combo.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi All,
Is there a way to display a form kinda frameless (without the blue bar going across the top and sides making is look like a new window and saying form2 on it)
Thanks in advance
Jaidev
|
|
|
|
|
Yes, set the FormBorder property ( from memory ) to none ( again, from memory ). It's along those lines.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I know the way to listing or enumerate sql server from my lan...
But is possible to listing or enumerate DB2 Server via VB or VBA???
|
|
|
|
|
How do you get a program to start @ windows start-up?
|
|
|
|
|
You would have to create a registry value in the HKCU\Software\Microsoft\Windows\CurrentVersion\Run key. See here for more information.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Or you can copy/move your program to the startup folder and it will start up as soon as you logon.
To access this folder you press start>> then
Programs>>Then startup>> then right click select open or explore.
With the registry keys you can use:
Local machine(Which starts the program for all users)
hklm/software/microsft/windows/run
Current user(Which starts the program for only the currently logged on user)
hkcu/software/microsoft/windows/run
Hope this helps!
|
|
|
|
|
Thanks for your replys....
|
|
|
|
|
I can see that I can use this to create a new tab page
But how can I make the Tab Page public?
TabControl1.Controls.Add(New TabPage("New Tab")))
Thanks
|
|
|
|
|
You would do it like this:
Declare the TabPage: Public ATab As New TabPage .
Then create the new tab: Me.TabControl1.Controls.Add(ATab) .
Hope this helps.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
|
cstrader232 wrote: But how can I make the Tab Page public?
You can't.
Objects aren't private or public, as you can never access an object directly. You only access objects using references.
You can declare a public variable that is a reference to a Tab Page, and assign it the Tab Page that you create.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi All,
I want WMP to set my timers off, everytime the 'play' button is clicked. However I cannot seem to find what the name of the intergrated 'play' function is.
for e.g.
Private Sub AxWindowsMediaPlayer1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxWindowsMediaPlayer1.Enter
If numberofcalls = 0 Then
Timer1.Enabled = True
End If
If numberofcalls = 1 Then
Timer2.Enabled = True
......etc
In this code timer1 is enabled when play is pressed right at the beggining, but when play is pressed again, timer2 doesnt seem to work (be enabled).
Thanks in advance
Jaidev
|
|
|
|
|
WMP has an event for the change of status, this can tell you when you're playing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
how do I use this event to verify that the wmp is playing?
|
|
|
|
|
Because 'playing' is one of the states that gets reported to the callback.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|