|
Wow. You're asking a huge question. There is no one source for learning how to make custom controls from scratch, just like there is no one source for learning how to make Windows Forms apps.
What's usually forgotten on people new to programming, or with little experience, is that the UI portion of an app or control makes up less than half the total code. The primary function of either of these code bases is data management.
Just about everyone who plays them doesn't realize that games are some of the most specialized, high-performance database applications you'll find.
The questions becomes how are you going to manage the data that the control is going to render? Are there any controls that you can use as a base that approximate what you want to do? If so, then a large chunk of your work is done. Why reinvent the wheel?
I don't have any articles or websites that tell everything about making custom controls. These are topics that can take up entire books. What you need to be doing is research. Picking up the books on VB.NET/C#/Whatever and going through them. Finding different custom controls and seeing how they work. Pick them apart and study them. Did you know that the Form class is nothing but an implementation of Control? Hmmm...
That's how I figured it out...
|
|
|
|
|
Yeh i figured as much. I may as well just tell you what i intend to do once i get more experience. The other day i was trying to figure out how to build those chm help files and figure out why it why it was so annoying to find ou how to do it and why the hell it all had to be external, so i set about making a control that has a treeview, header and content that would act like a chm help file but could just be added to a help form.
It will work off the treenodes because these can have many nested child items and layers, the only thing i need to add to the treenode itself is another collection to deal with sub Header's and contont on that particular page. Once each item can have sub headers and content in a collection, I will be able to have nested layers of help content. The two problems i'm having is building in the collection in the treenode and setting the treeview to use the custom treenode. I've added the collection Property and the like but that's as far as i've gone.
I realised it was going to be hard from the start but i will perservere, I start with something easier and work up.
At the moment i'm trying to change the menubar to be consistently glass looking on highlight etc.
Posted by The ANZAC
|
|
|
|
|
This is something that the control wouldn't normally store any data for. Well, at least not beyond an index of topics for the tree. You could do this by typing all your documentation up and storing it in a well-designed XML document. Load the tree information from the XML file for the treeview, then justhandle the click events and display the content loaded from the XML file(s) in a RTB or WebBrowser control.
The problem you're going to run into is creating another tool to actually write the documentation in, almost like a content management tool you'd find for web sites. So, you might want to look into existing tools to write your documentation and look into the file formats for the help files they output. Then write your control to handle those particular formats.
|
|
|
|
|
Ok Thanks a heap for all your help. BTW do you think an inbuilt help such as this is a good idea?
Posted by The ANZAC
|
|
|
|
|
It's up to you. If the current generation of tools and content capability just doesn't meet your needs, there's nothing wrong with inventing your own. Then the question becomes "Is it worth the time to develop it?"
|
|
|
|
|
I am trying to run an SQL statement to delete a record in my Access 2003 database (in VB.Net 2005).
In my table I have 2 fields.
1. VisitMRNo-DataType=Text
2. VisitDate- DataType=Date/Time and Format=Short Date
Right now, this is the code that I am using…
Dim MR As String
Dim SelectedVisitDate As Date
Dim SQL As String = String.Empty
MR = Me.txtMRNo.Text
SelectedVisitDate = Me.cbobxVisitDate.Text.ToString()
'initialize database connection
Using Connection As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Costco\My Documents\Visual Studio Projects\AnesXL.mdb")
'setup SQL command to delete records with matchin info
SQL = "Delete * FROM Pat20VisitDate WHERE VisitMRNo='" & MR & "' AND VisitDate='" & SelectedVisitDate & "'"
Try
'connect to database and delete the records
Connection.Open()
Dim Command As New OleDbCommand(SQL, Connection)
Command.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Delete of Visit Date failed")
Exit Sub
End Try
Once it gets to line Command.ExecuteNonQuery I get an Error: Data type mismatch in criteria expression.
I have watched both of these variables and they look fine in the Watch Window. How can I tell if what I am passing over is in the wrong format?
I really apperciate any help that I can get with this. Thanks!
|
|
|
|
|
What is the value of SQL at the time of the exception?
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Hey TCJ, thanks for your reply. According to the VB watch window this is the value of my SQL..."Delete * FROM Pat20VisitDate WHERE VisitMRNo='8822' AND VisitDate='12/12/2000'"
|
|
|
|
|
Answered in another post, but for other users with a similar problem # signs need to be around dates.
Other rules for access sql text:
dates should be the date with pound signs ex. #08/25/06#
boolean should be true or false (no quotes) ex. true
numbers should be just the number(no quotes) ex. 25
text is enclosed in single quotes ex. 'Test'
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
CCG3 wrote: VisitMRNo
I'd guess this is a number, and you're passing it as a string ( so remove the quotes )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
No, VisitMRNo is setup as a Text so I am passing it a string. But just so you know, I have already tried that. I have tried this with no quotes on either of them and on neither of them and I still get the same message.
|
|
|
|
|
Is there an easy way to take a program written in VB.net for the windows desktop platform and convert it to the Pocket PC?
For example I have a simple blackjack program I wrote for a class and was thinking of converting it over so I could load it onto my PPC as a test before I attmept to do it with a more complex project I am working on.
Is it worth trying or should I just rewrite it?
David Wilkes
|
|
|
|
|
Why not try it? If you get a monster list of errors, pick through them and see what they affect. Then you can judge weather it's worth fixing or a rewrite. What's the worst that can happen?
|
|
|
|
|
Tried adding the form to the PPC project but ended up with more errors than code. Was hoping there was a tool or macro that would convert from one to the other.
Luckily all of the classes and most of the sub's/functions can be cut/paste with only minor modifications. The tedious part is getting the forms set up with all of the controls and getting them named correctly.
Thanks anyway,
David Wilkes
|
|
|
|
|
Hi!
I am looking for the code that write a string to the Textbox of a other Program.
I find out, that I can activate a other open Program by :
"AppActivate(Program)"
and write there something by :
"My.Computer.Keyboard .SendKeys(XYstring)"
if there is any textbox activated.
And now the Question: is it possible to activate in this other "Program" a certain Textbox?
Just the hope that accidently the right textbox is activ is not enough.
Hans-Christian
|
|
|
|
|
Maybe. It depends on the other program. If it is possible, it's with great difficulty.
You have to find the window handle of the application is question, then traverse the window tree to find the window handle of the textbox in question. Then you can pass that window handle to the Win32 function ShowWindow (I think!) to give it the input focus. Then you can TRY to stuff keystrokes into it with SendKeys.
There is a problem with this though. You cannot guarantee that the focus will stay in that window in the time it takes to go from focusing that window and stuffing the keyboard. You could very well end up stuff those keys into another window!
A better method would be to use the Win32 function SetWindowText to put the string into that window.
But, the hardest part of this is going to be getting the handle of that textbox. You have to be very familiar with the windows in that application (not the visual part you see on the screen, but the parent/child relationship of the variable controls in those windows!
In short, you simply don't have that much control over the visual elements of another application.
|
|
|
|
|
As the previous poster said, it can be done with great difficulty. If you decide to delve into the Win32API, I would strongly recommend a book by Dan Appleman "Visual Basic Programmer's Guide to the Win32 api". It is a superb api reference documenting a significant number of the underlying windows api's and how the OS works at an api level. It was written for VB4-6 so any code examples have to be adjusted language wise for vb.net/c#, but as a C# programmer I can tell you I've never found a better api reference.
topcoderjax
|
|
|
|
|
You might want to try replying to the original poster. That way, he'll get an email you replied.
|
|
|
|
|
Thanks... Guess I assumed that as the original poster he would get all traffic on the post.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Nope. Only the person you reply to gets the notifications.
|
|
|
|
|
Reposting the following just in case it wasn't received:
As the previous poster said, it can be done with great difficulty. If you decide to delve into the Win32API, I would strongly recommend a book by Dan Appleman "Visual Basic Programmer's Guide to the Win32 api". It is a superb api reference documenting a significant number of the underlying windows api's and how the OS works at an api level. It was written for VB4-6 so any code examples have to be adjusted language wise for vb.net/c#, but as a C# programmer I can tell you I've never found a better api reference.
topcoderjax
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Visual Basic 2005 Express:
My app checks the website to see if a new version is available.
How can I have it link to MyApp.msi on the website to download and install it if a new version is available?
|
|
|
|
|
I may be wrong, but doesn't ClickOnce deployment already support doing this? I don't konw for sure since I have very little use for ClickOnce in my environment.
|
|
|
|
|
I don't like ClickOnce, I am using a Windows Installer Setup project to deploy.
|
|
|
|
|
Then you'r going to have to write the code to check a website yourself. The website should have an XML file for version information and a download package available. This package would have to be unpacked and installed on the client side, but from a seperate executeable, not your main EXE. This is because you can't overwrite an EXE while it's running.
The web information can be had by using the WebRequest class, along with downloading the file. Launching a seperate process is easy with the Process class. XML file processing is also easy with the XmlDocument class and XPath.
|
|
|
|