|
I tried to run the query again and the program still freezes. When I ran the query again I also populated a completely different dataTable and it still didn't work. Then I tried to create a clone of the original dataTable and then the list box will populate and the program does not freeze, but the combo box does not populate.
|
|
|
|
|
The app freezing is not a typical symptom of what goes wrong when you reuse a datasource. Usually changing one control just causes te other to change too. My guess is that you're not cloning it properly, and your source is empty. And, I would guess that you have code running on a selected index change which is being run by the databinding, and causing it ti freeze. If you break out or if you set breakpoints around the related code when you debug, wat happens ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Right now it is not freezing. I just need to figure out how to populate this combo box with the teacher names.
Here is my code for cloning the datasource. I tried doing it several ways.
' query
tableName = "tbl_teachers"
dtTeachName = generalQuery()
' fill the teachers checked list box
lstTeachers.DataSource = dtTeachName
lstTeachers.DisplayMember = "teach_name"
lstTeachers.ValueMember = "teach_id"
cboSchedDur.SelectedItem = "This Week"
'End If
' fill the teachers checked list box
dtTNameClone = dtTeachName.Clone()
cboSelectTeacher.DataSource = dtTNameClone
cboSelectTeacher.DisplayMember = "teach_name"
cboSelectTeacher.ValueMember = "teach_id"
|
|
|
|
|
does dtTeachName contain any data ? If it does, it should be showing.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
It does show data. I populated another list box from the data, but when I make the copy it does not fill the combo box.
The list box and the combo box are filled in 2 different sub procedures. The dataTables that I am using are declared globally in a module as public.
|
|
|
|
|
AAGTHosting wrote: The dataTables that I am using are declared globally in a module as public.
Well, they should exist solely for the control that's using them, making one global like htat is a poor design.
Christian Graus - Microsoft MVP - C++
"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 tried declaring local dataTables and it still does not work. I just ran the same query again and the list box populated, but when I click on the students button to go to that panel all the controls on the panel do not come up.
Here is my query. Would it be better for me to use a GetDataBy query instead of a fillBy? The GetDataBy method returns a dataTable.
|
|
|
|
|
Where is your query ?
Sounds like what you're really saying is that you have a button event which is not working, have you set a breakpoint in there ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
This only seems to happen when I try to populate the second teacher list box. If I comment out the code to bind a source to the teacher combo box then only the first name on the list of teachers shows up in the teacher list box, then when I click on the students button one of my list boxes shows up, that is not filled dynamically and you can't select a type of student.
Should I use multiple datasets so I don't have multiple controls getting info from the tables in the dataset?
|
|
|
|
|
you can bind multiple combo boxes to the same dataTable if each has its own binding source
|
|
|
|
|
I am getting error in the following code...
---------------------------------------------------------------------------------------
<br />
<br />
odbAdapter = New OleDbDataAdapter("select * from tblEmployeeAttendance", objConnection)<br />
<br />
ap.Fill(ds, "EmpAttendance")<br />
<br />
Dim i As Integer = ds.Tables(0).Rows.Count
---------------------------------------------------------------------------------------
When I add a watch on "ds.Tables(0).Rows" add check its Items property....
I see "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."
Following is the structure of tblEmployeeAttendance table in an MS Acceess database.
ID - AutoNumber
EmployeeCode - Text
AttendanceDate - date/Time
AttendanceCode - Text
AttendanceDescription - Text
AttendanceDescriptionDate - Date/Time
-------------------------------------------------
Do you have any idea about the cause of this error...?
Thanks,
Arun
“The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”
|
|
|
|
|
You have to supply the row index to view the data with in. In this case you would have to watch ds.Tables(0).Rows(0).ItemArray in order to see the first row in the table.
But if you have Visual Studio 2005 you can do a QuickWatch and click on the magnify glass icon to actually load the whole database into a grid to view the data...not available in VS2003 though.
Hope this helps.
|
|
|
|
|
Thanks for your help.
Now, using
Dim i As String = dsToupdate.Tables(0).Rows(0).Item(0)
returns correct value.
But how can I use it in looping through each row in the data set...
Currently my code looks like this...
For Each dr As DataRow In dsToupdate.Tables(0).Rows<br />
If (dsToupdate.Tables(0).Rows.Count > 0 And (Not (dr.Item("EAR_Employee_Code") Is Nothing))) Then<br />
<br />
dr.Item("EAR_Employee_Code") = strEmpCode<br />
dr.Item("EAR_Attendance_Date") = dtpAttendanceDate.Value<br />
dr.Item("EAR_Attendance_Code") = strIsPresent<br />
dr.Item("EAR_Attendance_Desc") = strDesc<br />
dr.Item("EAR_Attendance_DescDate") = strDescdate<br />
<br />
End If<br />
Next
------------------
can you please provide me a hint how to change the above code to access each item in each data row...?
I am using VS2005.
Thanks,
Arun
“The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”
|
|
|
|
|
I guess I really don't understand what you are asking. I think you are doing it correctly. You do not need the dsToupdate.Tables(0).Rows.Count > 0 check because the For Each statement will not run if the table is empty. But I don't know of any other way to access each column in the data row. It's easier to user the column names like you did here, than to use the indexes of the columns. Unless you are setting all of the items to the same number, in which case you can loop through the columns inside your row loop...by adding something like this:
For Each dc as DataColumn in dsToupdate.Tables(0).Columns<br />
dr.Item(dc.Name) = "VALUE"<br />
Next
Hope this helps.
|
|
|
|
|
Hi!
With the help of your first post I successfully solved the issue.
A 5 from my side.
Thanks a bunch...
Bye
“The woods are lovely, dark and deep. But I have promises to keep, and miles to go before I sleep.”
|
|
|
|
|
Ok, so I have a button that when pushed, it runs a batch of code.
My question is, is there a way to, when the button is pushed, put a progress bar to monitor when the batch of code is finished running and the progress it has made while it is running?
Any help at all is appreciated.
Thanks.
|
|
|
|
|
Yes. You should research the Background Worker object and the Pogress Bar control.
Here[^] is a list of articles to help you get started.
|
|
|
|
|
Hello,
I need to drag some graphics images across the screen, across other backgound items. Anyone have snippet or ideas of how to do that? I've looked at rubber-band lines, for instance, but didn't find anything good yet.
Seems maybe like
1. when the mouse goes down, erase the image and get a snapshot of the background screen
2. draw the image in its new place(s) as the mouse is moved
3. when the mouse is lifted, redraw the snapshot from (1) and the draw image in its final place.
Seems like there should be an easier way?
Thanks
|
|
|
|
|
What's easier than that ? This is still programming, we still need to write code. Any movable object, I would simply draw it in the paint event, and change the location and invalidate during mouse move if it's being moved.
You can use CreateGraphics to draw a dragged object if yuo like, but I don't see the benefit.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi,
i have developed an application to zip the file using shell32.dll file and natively zipped the file now i want to encrypt the file with password ie.,same as how we provide password to the zipped files
i want to do this programmatically can anyone please help me out in this regard it will be great help!!!
Thanking You in advance
nagashree
|
|
|
|
|
The shell does not support this, you'll need a third party library to do that.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Quote
The WinZip Command Line Support Add-On is a FREE add-on for users of WinZip Pro with a valid license. Before installing this add-on, please make sure you have WinZip Pro installed.
The WinZip Command Line Support Add-On provides a command line interface that gives you the power of WinZip without the usual WinZip graphical user interface. It allows you to use WinZip directly from the command prompt and from batch (.BAT) files and script languages, making it ideal for automating repetitive tasks. An extensive set of command line options gives you pinpoint control over WinZip's actions. And, in automated environments, end-users need not know anything about how to use WinZip.
Thats a wrap!
Autodev
|
|
|
|
|
If my application is Windows Form I just use App.StartUpPath,But if it is class library can i get path of library.
|
|
|
|
|
Hi,
you will need the Assembly class, get the assembly instance you are interested in
(maybe with GetExecutingAssembly), and look at one of its properties (probably Location).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thank you Luc Pattyn you help me again.
|
|
|
|