I am using Visual Studio 2008, and i am working with a single document application, it is CView Based, and i want to know how i can in addition to the view, that i will be drawing on, how i can add controls, like CButton and CListBox. do i have to make a toolbar, or can it be added to the view? a simple example would be nice
You can add controls, but it might be easier to use CFormView which is derived from CView but acts like CDialog.
To add a button to your CView, just create an instance of CButton in the CView's class, then when initializing CView class call the button's Create() method. Of course before calling Create() you will have to create a CRect (or just RECT) which you pass to Create(). I don't have an example to show you but its not all that difficult to do. It may take a few tries to get the CRect coordinates just right because you can't do it visually like you do with CDialog or CFormView.
search www.microsoft.com for CListBox. You can find everything you need there, and for all the windows classes. You should use that for all your MFC questions, if you can't find it there then post question here. There is a lot of things though that MSDN doesn't tell you.
You should also be able to just press <F1> while in the compiler's IDE and it will take you right to the search box. I'm being a little bit evasive because you need to learn how to look it up yourself.
ok, i made an attempt to add a button to the CView. but it isn't working, no errors, just not showing up. i think i am passing something incorrectly, or i'm trying to do this in the wrong place.
button1 is declared as public in the class declaration, as is button1Rect (neither are pointers) so i tried this:
BOOL CGDI1View::PreCreateWindow(CREATESTRUCT& cs)
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
button1.Create(_T("HI"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,button1Rect,this,1);
is this the wrong method to try this in, or should i not be passing "this"? sorry for my ignorance on the subject, i'm new to MFC
If the 'verified' funtion fails (returns NULL or FALSE), you'll be seeing a Debug Assertion Failure dialog box with an option to debug the program, so you can quickly figure out where things are going wrong. In Release builds, VERIFY() does nothing.
About generic Windows error codes, here is a brief introduction.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...