|
i have a form allows me to add, edit, delete records, and also see the master list of my records, this form has a dataset and a winsock-like object (private withevents) this application is connected to a server using my winsock-like object
what it does is that everytime i click on add or edit, a new form is instantiated and the record which i want to edit from the previous form is loaded in this new form (in the case of add, no data is loaded on the form) after adding or making the changes, the new form calls the add record method / edit record method to...
1. update the changes to the database
2. pass the new data to the server using my winsock-like object
after executing, the new form closes itself. i don't have any problems with updating changes to the database, but when i try to send the new data thru my winsock-like object, it gives me a "object reference not set..." error where in fact i clearly created a new instance of my winsock class when the form was loaded and the connection is still alive between my application and the server, should i change the modifier of my winsock-like object from private to shared or protected? please tell me what went wrong, thanks
|
|
|
|
|
It's definately not a modifier problem. You'll have to supply some code and the exact error message and the line it shows up on. It could also be that the problem is in your "winsock-like" object. Is your object throwing the exception and your main code catching and not handling it?
RageInTheMachine9532
|
|
|
|
|
thanks anyway, it's already working, i realized that i instantiated the winsock object during "form load" and not inside the form's constructor
|
|
|
|
|
How do you pull data from a database and set them as columnheader in listview or a datagrid?
|
|
|
|
|
Are you using a stored procedure?
Give more info about your requirements...
Later
|
|
|
|
|
Student_Name Teacher_Namer Subject Time Date
James Keith Prof. Clark Math 9:00am 01/05/2004
James Keith Prof. Moore English 10:00am 01/05/2004
James Keith Prof. Smith Art 11:00am 01/05/2004
James Keith Prof. James P.E 1:00pm 01/05/2004
James Keith Prof. Brooke Chem 2:00pm 01/05/2004
James Keith Prof. Daniels Math 3:00pm 01/05/2004
Peter Robertson Prof. Clark Math 8:00am 01/05/2004
Peter Robertson Prof. Moore English 12:00am 01/05/2004
Peter Robertson Prof. Smith Art 4:00pm 01/05/2004
Peter Robertson Prof. James P.E 5:00pm 01/05/2004
Peter Robertson Prof. Brooke Chem 6:00pm 01/05/2004
Peter Robertson Prof. Daniels Math 7:00pm 01/05/2004
Teachers + Prof. Clark + Prof. Brooke + Prof. Daniels
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Time
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8:00 + Peter Robertson + +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9:00 + James Keith + +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1:00
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2:00 + + James Keith
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The list view will be controlled by a date or calendar control. Haven’t decided whether to use a stored procedure. Since I use a select statement with a case argument. Still not getting the look I want.
It would be similar to a cross tab table used in ms access.
<table border=1 cellspacing=0 cellpadding=0><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p align=right style='text-align:right'>Teachers</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>Prof. Clark</p><br />
</td><br />
<td width=136 valign=top class="Normal"> <br />
<p>Prof. Brooke </p><br />
</td><br />
<td width=152 valign=top class="Normal"> <br />
<p>Prof. Daniels</p><br />
</td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>Time</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>8:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>Peter Robertson</p><br />
</td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>9:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> <br />
<p>James Keith </p><br />
</td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>10:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>11:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>12:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>1:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>2:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> <br />
<p>James Keith</p><br />
</td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>3:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> <br />
<p>6:00</p><br />
</td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> <br />
<p>Peter Robertson</p><br />
</td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
<tr> <br />
<td width=155 valign=top class="Normal"> </td><br />
<td width=147 valign=top class="Normal"> </td><br />
<td width=136 valign=top class="Normal"> </td><br />
<td width=152 valign=top class="Normal"> </td><br />
</tr><br />
</table>
|
|
|
|
|
Hey Ole123
Well I will leave the front end to you, but if you choose to go with a stored proc then here is the basic layout including getting the headers...
CREATE PROCEDURE MP_CB_Get_CallBacks
AS
-- V1.0.0 : Super Winsock : 4 March 2002
-- Returns the Column names and width for the grid.
-- It also returns the data.
SET NOCOUNT ON
--Returns the Column names and it's width.
-- 1st is the column name & 2nd is the column width and so on.
SELECT
'Id',
0,
'Student_Name',
0,
'Teacher_Name',
2000,
'Subject',
1500,
'Time',
1500,
'Date',
1500
SELECT
[Id],
Student_Name,
Teacher_Name,
Subject,
Time,
Date
FROM
?Table
SET NOCOUNT OFF
GO
/* Hope this helps?
|
|
|
|
|
I forgot to add that the student data is a seperate table as well as the teacher's data. So I have a Student and Teacher table. I don't think I could use a stored procedure.
|
|
|
|
|
Well thats no problem?? Just use a JOIN statement to join the teacher and Student tables... This can be done in a sproc.
If you really get stuck, just post the Student and Teacher Tables structures and what you want to get out of them in your record set, and I will gladly help you write the sproc.
Later
Cliff
|
|
|
|
|
Student_ID | Student_Lname | Student Fname | Subject ID |
----------------------------------------------------------------------
125 | Mason | Steven | 2 |
100 | Jude | Bob | 2 |
199 | Mason | Mark | 2 |
125 | Mason | Steven | 4 |
225 | Stevenson | John | 2 |
125 | Mason | Steven | 5 |
400 | Madison | Ira | 2 |
Teacher_ID | Teacher_Lname | Teacher_Fname | Subject ID | Subject Name| Date | Time|
------------------------------------------------------------------------------------------------------------
1 | Mason | Steven | 2 | Math | 1/1/2004 | 11:00 am
2 | long | Gary | 2 | English|| 1/1/2004 | 1:00 pm
3 | Clark | James | 2 | P.E| 1/1/2004 | 11:00 am
4 | Simmons | Micheal | 4 | Science| 1/1/2004 | 11:00 pm 5 | Bonnila | Richard | 2 |Art | 1/1/2004 | 11:00 am
6 | Law | Katherine | 5 |Social Studies| 1/1/2004 | 9:00 am
7 | Young | David | 2 | Econ| 1/1/2004 | 8:00 am
It should be displayed in the list view as
Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels
___________________________________________
Time
____________________________________________
8:00 | Peter Robertson | Blank|Blank
____________________________________________
9:00 |James Keith | Blank|Blank
____________________________________________
10:00| Blank|Blank| Blank
____________________________________________
11:00| Blank|Blank| Blank
____________________________________________
12:00| Blank|Blank| Blank
____________________________________________
1:00| Blank|Blank| Blank
____________________________________________
2:00 | Blank|Blank| James Keith
____________________________________________
|
|
|
|
|
Still a little stuck so i still need help. I posted a sample tables in the post and what the display should look like...
Thanks for all your help. I have been kicking my self for about two weeks trying to get the display i want with no success.
MSSql does not use the Transform sytnax so i'm not able to create the crosstab look and feel for my listview form in vb.net.
Thanks again for all your help
|
|
|
|
|
Hey Ole
Well your post of the tables is somewhat confusing
Teachers |Prof. Clark | Prof. Brooke | Prof. Daniels
___________________________________________
Time
____________________________________________
8:00 | Peter Robertson | Blank|Blank
____________________________________________
9:00 |James Keith | Blank|Blank
etc...
1.Are your headers always going to be the same? If so then you can just hard code them.
2. Just tell me what the headers are and from there I can get the info from the tables.
3. In a listbox you have to use COURIER NEW as your font, else the spacing is never going to be right.
4. You have to pre-determine your column lengths before you populate the listbox. IE: If you have a column named First_Name, thats 10 characters, and the name is Ole. You will have to add 7 spaces after the name to make the next column's data in line with its header.
Probably a bit confusing the way I explained but just tell me the column headers and I will write the sproc. Thats the easy part.
You will have to do the front end.
Later
Cliff
|
|
|
|
|
The columnheader will always change. So it's more of a dynamic columnheader. Depending on the Day of the week. There could be 5 or 3 or 10 teacher who have classes to teacher at different time of the day.
The Teacher's name will be the columnheader
Basically i'm trying to build a cross-tab query
Teaher's names across the top
The time is in the left column down
and student name
Teacher_Name Teacher_Name Teacher_Name Teacher_Name
Time Student_Name Student_Name Student_Name Student_Name
C1 and R2 = Student_Name C2 and R2 = Student_Name
C1 and R3 = Student_Name C1 and R3 = Student_Name and so on
The only way i can build a cross-tab query is in crystal report.
|
|
|
|
|
My main form has a toolbar, menu, docking windows on the left, top, right and bottom - i now want to change the toolbar and menu for a third party control - how do I get the new toolbar and menu onto my form (I cant change the docking on the docked windows as they have to be docked even at design time)
Rugby League: The Greatest Game Of All.
|
|
|
|
|
i want to be able to update info in a datagrid and then save it to my database, any ideas?
|
|
|
|
|
Lots of them. But your going to have to get alot more specific about what your want to do and how you want to do it...
RageInTheMachine9532
|
|
|
|
|
i made a basic program that adds info to an acess database and displays it in a datagrid, i want to edit the info though the grid and update the database....
|
|
|
|
|
you can find very usefull documentation at Visual Studion.NET help.
concisely you must use and Update column at the DataGrid and use the Update method of the DataSet you used to create the DataGrid to update the data to Access database.
if you won't find any example at vs.net help i can send you a small sample code about updating database with dataset
Manos Papaoikonomou
|
|
|
|
|
I would like to know if there is any tool available for Visual Basic 6.0 which can reproduce MATLAB's 3D surface plotting, like the fill3 MATLAB function?
Thanks
Luiz Carlos Junior
|
|
|
|
|
Is it possible to set a form's location and size before displaying it? I have a couple of resizable forms in my current project. I'd like to have the app remember the size and location of the forms when the user last closed them.
|
|
|
|
|
I'll leave the part about saving and retrieving the values up to you since there are so many methods of saving these values somewhere...
You can set the Size, Location and StartPosition properties of the form before you call the form's Show or ShowDialog method:
Dim newForm As New Form2
newForm.Size = New Size(100, 200)
newForm.StartPosition = FormStartPosition.Manual
newForm.Location = New Point(50, 50)
newForm.Show()
RageInTheMachine9532
|
|
|
|
|
Perfect. And by inserting the middle three lines into the Load event, and changing 'newForm' to 'Me', I've managed to change the main form as well. Don't worry about the saving - I've got that bit sorted out.
Thanks for your help.
|
|
|
|
|
Hi..I want to configure the data adapter to select all columns from a aspecific table in my database then fill the dataset with this data and do some functions on the data and then i want to display the results in a datagrid how can i do this and can i find any VB.NET code example to do it ?
Thanks
|
|
|
|
|
If you create the dataset using the Fill command of dataAdapter - for example
dtAdapt.Fill(myDataset,"TableName")
then you write:
myDataGrid.DataSource = myDataSet.Tables("TableName")
Manos Papaoikonomou
|
|
|
|
|
Thanks for your reply but I don't want to display all the data from the dataset I want to do some functions on some columns from the dataset and then display the results in the datagrid any idea ?
|
|
|
|