|
ALL of carlos's cool controls contain sample applications that show how to use them...
Had me stumped just a bit as well when I first started trying until I realized that his controls don't have designers (don't show up in the tool box) so you have to load them manualy in the code.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
Hi, I'm new to .NET and I'm writing an application that is using the TabControl , and I'm having trouble finding a method or property that will tell me what specific TabPage was clicked when the TabControl is clicked. In the Click event for the TabControl is it possible to tell what TabPage was clicked? I can't seem to find any property or method that would give that.
Another question. Is there any type of event for the TabControl or TabPage that is similar to the Load event for a Form ? What I'm looking for is an event that would fire the first time a TabPage was clicked and then never again until the program was closed and opened.
Any help is much appreciated.
- monrobot13
|
|
|
|
|
monrobot13 wrote:
I'm having trouble finding a method or property that will tell me what specific TabPage was clicked when the TabControl is clicked. In the Click event for the TabControl is it possible to tell what TabPage was clicked? I can't seem to find any property or method that would give that.
Register the Click events for each tabpage instead all pointing to one delegate. Then in the delegate method do a cast to TabPage for the object sender parameter.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
First, Thanks for the reply.
Second, This is the approach I would have taken but I using the webbrowser control on the tab and it's set to take up the entire size of the page. I want the webpage to load when the tab is clicked I don't want the user to have to click the actual webbrowser page for it to load.
- monrobot13
|
|
|
|
|
To determine which TabPage is currently selected, look at the TabControl.SelectedIndex property, and to catch when a user selects a different TabPage, subscribe to the TabControl.SelectedIndexChanged event - watching Click events is not the way to do it with the TabControl.
There is no Load type event for a TabPage, but there are a number of ways to do what you're looking for.
Create booleans to flag whether each tab has been "loaded"; e.g.
bool tabPage1Loaded = false;<br />
<br />
void OnSelectedIndexChanged(object s, EventArgs e)<br />
{<br />
if(tabControl.SelectedIndex == 1 && !tabPage1Loaded){<br />
tabPage1Loaded = true;<br />
}<br />
}
Or, if your tab pages are created dynamically and hard-wiring booleans would be impossible or just messy, just create a new class derived from TabPage and add a "Loaded" property to it.
Hope this helps
|
|
|
|
|
Again thanks for the reply.
This sounds like a good approach I just have a question. Is it possible to get a reference to the actual TabPage from the selected index? ie. could I just use it as the index in the tabs collection for the TabControl ?
Thanks again
- monrobot13
|
|
|
|
|
monrobot13 wrote:
. could I just use it as the index in the tabs collection for the TabControl?
Yep, sure can.
|
|
|
|
|
Sounds good.
Thanks again.
- monrobot13
|
|
|
|
|
Hi,
how to break a line of text ? The only way i found out is to use the <p></p> tag, but i guess that only works cause i use NDoc to generate Html based Help Files, what about another generator format like RTF ? Guess the <p> tag is exported as normal text, and not interpreted as line feed.
Which solution is clean ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
|
seems like my html tags are eaten by html
.:Greets from Jerry Maguire:.
|
|
|
|
|
Jerry Maguire wrote:
Which solution is clean ?
There is a para tag which can be used for creating paragraphs.
If you search MSDN for 'XML documentation' you should see a section which tells you what tags are available for use.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
hi,
I have a datagrid which has obviously rows and cols.
I am placing a usercontrol on top-of-it. now when I move that
usercontrol it should be only movable with in certain area.
to be more specific I want to know
what is the area starting from the first visible row/col
and last/bottom visible row/col so that I can compute
that area and can't let the user move beyond that control
Paresh
|
|
|
|
|
Hi,
I am trying to setup a custom baud rate of 12000 but when I use the SetCommState() I get an error message telling me to review my set. However, any custom baud rate below 10000 will be set and work properly.
What is wrong? I need to use custom baud rates above 10000!
I have attached a sample program that anyone can use to test it.
Thanks
<code>
// *********************************************************
// A program that demonstrate the custom baud rate problem *
// *********************************************************
#include <windows.h>
#include <stdio.h>
#include <lmerr.h>
#include <stdlib.h>
void DisplayErrorText(DWORD dwLastError); // show last error
// message
#define RTN_OK 0
#define RTN_USAGE 1
#define RTN_ERROR 13
int main(int argc, char *argv[])
{
DCB dcb; // structure that hold all COM parameters
HANDLE hCom; // handle for the COM port
BOOL fSuccess; // to hold fail/success results
// test if 2 parameters has been supplied in teh command line
if (argc <= 2)
{
printf ("Please enter a COM port and the new baud rate in the command line.\n\ni.e.: porta COM2 1000\n");
return (1);
}
// Open the COM port
hCom = CreateFile( argv[1], // open the COM specified on teh command line
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
// test if open COM was ok
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (2);
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
// test if getting the com state was ok
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (3);
}
// Print previous baud rate for the specified COM port
printf ("\nThe baud rate of %s was %d.\n", argv[1], dcb.BaudRate);
// Fill in DCB with supplied bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = atol(argv[2]); // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
// set the COM port with the new parameters
fSuccess = SetCommState(hCom, &dcb);
// test if setting COM port was ok
if (!fSuccess)
{
// Handle the error.
printf ("SetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (4);
}
fSuccess = GetCommState(hCom, &dcb);
// check to see if new baud rate has been set
if (!fSuccess)
{
printf ("GetCommState failed with error %d. ", GetLastError());
DisplayErrorText(GetLastError());
return (5);
}
// Print current baud rate
printf ("\nNow it is %d.\n", dcb.BaudRate);
return (0);
}
// *******************************************************
// Simple routine to show the error messages description *
// that is really useless!!! *
// *******************************************************
void DisplayErrorText( DWORD dwLastError )
{
HMODULE hModule = NULL; // default to system source
LPSTR MessageBuffer;
DWORD dwBufferLength;
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM ;
//
// If dwLastError is in the network range,
// load the message source.
//
if(dwLastError >= NERR_BASE && dwLastError <= MAX_NERR) {
hModule = LoadLibraryEx(
TEXT("netmsg.dll"),
NULL,
LOAD_LIBRARY_AS_DATAFILE
);
if(hModule != NULL)
dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;
}
//
// Call FormatMessage() to allow for message
// text to be acquired from the system
// or from the supplied module handle.
//
if(dwBufferLength = FormatMessageA(
dwFormatFlags,
hModule, // module to get message from (NULL == system)
dwLastError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // default language
(LPSTR) &MessageBuffer,
0,
NULL
))
{
DWORD dwBytesWritten;
//
// Output message string on stderr.
//
WriteFile(
GetStdHandle(STD_ERROR_HANDLE),
MessageBuffer,
dwBufferLength,
&dwBytesWritten,
NULL
);
//
// Free the buffer allocated by the system.
//
LocalFree(MessageBuffer);
}
//
// If we loaded a message source, unload it.
//
if(hModule != NULL)
FreeLibrary(hModule);
}
</code>
|
|
|
|
|
First of all, I think you're in the wrong forum. This is the C# forum and you have posted C++ code. Second, there are several articles on CP in which other people have done all of the hard work for you. Just use their classes and you won't have to go through the headaches these folks have already endured. To name a few articles:
Serial library for C++
By Ramon de Klein (I've personally used this one and I think it's great)
CSerialPort v1.03 - Serial Port Wrapper
By PJ Naughter(This one has a high score, so I can only assume that it has been useful to many people)
Good luck and best regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I was just wondering if anyone knew how to create a command window or console as found in VS.net?
I have had a look arround and there dont seem to be any tutorials or even any references to them. If there arnt any examples does anyone have any hints or tips on creating one?
Thanks
Tim
|
|
|
|
|
You're question is a little confusing. Are you asking how to make a console application (i.e. an application with no graphical UI)? What command windows/console in VS .NET are you referring to?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
i dont want to make a console application i want to make a windows application with a console in it (as seen in VS.net if you go... View> Other windows> Command Window. or on the keys... Ctrl+Alt+A)
I will use the console in a seperate window to my main app to perform some program specific functions and to allow users to write and run scripts of multiple operations.
Hope this helps clarify things?
|
|
|
|
|
I see. OK. Well this really depends are your exact needs. Frankly, I'm not sure how they implement the expanding and contracting thing because I've never tried it (and I know that that is not what you're concerned about), but it occurs to me that no matter how you implement your user interface (e.g. splitters, separate windows, etc.) as long as you have a way of getting input (e.g. a text box), you should be able to just read the commands whenever the enter key is pressed inside of that edit area. This probably doesn't really help you much, but I guess I'm not sure what the big mystery is. I'm probably over simplifying, so tell me what else I need to know to get to the heart of the issue.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
i implemented a really simple console app for my text editor..if you would like i can email you the source so you can get a general idea....(its easy to do you will see)
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
if you could email it to me id be most greatful, and it would help me a great deal.
My mail is blue@nildram.co.uk
|
|
|
|
|
Im not worried about the expanding and contracting at the minute, i can sort that out at a later date as i need that in other parts of the application. Im not to worried about the GUI at the minute either, it will be in a box similar to that in VS.net but thats not essential.
What i was wondering is if there was any implimentation of it as ive used languages that have it (ie TCL/TK) and i think java has one? i dont know how id go about calling commands "dynamically" though? would i just have to have switch/case statements for every posible command that could be run or is there a way of calling methods "on the fly"?
I dont think you are over simplyfying it at all i think i needeed your imput to see that i was over complication the whole thing.
My only worry is about the fact that some characters will need to be read-only, others writeable etc. do you have any ideas on how i could deal with that?
Thanx
|
|
|
|
|
Hi!
I'm curious about if anybody is using .NET in desktop application development. I've just finished a live chat front-end using Windows Forms in C#, similar to Humanclick. Did not used any code obfuscator, mainly because the front-end itself don't have utility without the server's components (the windows service it uses and the aspx pages used in administration), so having people disassembling it is not a big issue.
I'll distribute the front-end to my customers along with .NET framework runtime and other stuff on CD-ROM, but will let customers to download it from web too. Now comes the big question: The .NET framework runtime is about 20Mb. Does somebody developed an application which requires the user to download the runtime? Will them install it? Or .NET is being used only for server side application development?
Thanks,
John
|
|
|
|
|
Microsoft answer are :
- the .NET run-time is soon part of the operating system, so it's not a problem anymore. Besides that, beginning with XP SP1, the .NET run-time is part of the service pack (XP SP1 CD).
- .NET run-times can run side-by-side, hence users will be able to have both the (current) 1.0 release and soon coming 1.1, and actually have applications to work with the appropriate run-time.
Of course, that's a lot of marketing. First, I can't see shareware authors distributing software that require 20MB++ (and ++ is up to 180MB) of binaries before they can start your app.
In addition, the application author must have anticipated a built-in .config file to manage seamlessly the case of multiple .NET run-times installed on the same machine. Otherwise, it fails miserably with a stupid MS error box.
I can see in-house desktop app development using .NET, that is in environments where deployment is not an issue. I don't see for the foreseeable future high end customer .NET desktop apps. But may be that's only me.
(That's a totally different story when we are dealing with server-side : ASP.NET, web services, ...).
|
|
|
|
|
.S.Rod. wrote:
I don't see for the foreseeable future high end customer .NET desktop apps. But may be that's only me.
I agree, however, I am always reading that .NET is replacing WinAPI,MFC,etc., but I really don't see that happening for pure desktop application development.
Sometimes I wonder if when I work with MFC/ATL, am I just wasting my time with a technology that will soon become extinct?
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|