|
Hey,
I have a small problem. I created a UserControl within a Windows Forms Project, added all the controls needed, code behind...everything. It was working OK. When I reopened the project I was surprised to see that on my usercontrol...in design mode there are no controls on it. In the Properties toolbox, the list of controls that "are" on the control are there...all their properties are the right ones. I tried looking in the designer file...the InitializeComponent method is OK. So everything is there where is supposed to be...except my controls on the form . I want to ask, if anyone had come across this problem...because it happened to me several times on different computers. By the way...I'm using VS 2005.
Thanks.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
I've had the same problem and found by closing and reopening it solves the problem. As far as what causes it I ain't gotta clue!
Good Luck
Mike
Life is not measured by the number of breaths we take, but by the
moments that take our breath away. "George Carlin"
|
|
|
|
|
I have a richtextbox, each line has in it a unique 6 digit number on the line so I can find the line number but then I want to search just the given line from character position x to end of that line for a different character pattern and select them so as to allow me to change their fore and background colours.
Currently I select the unique text on a line and change it's color thus
rtxtResults.Select( rtxtResults.Find(texttofind),(texttofind.Length));
rtxtResults.SelectionBackColor = Color.Red;
rtxtResults.SelectionColor = Color.Gold;
I then want to be able to search all charicters that follow the text found above to the end of that line only.
I asume I would somehow need to use rtxtResults.GetLineFromCharIndex but can’t work out a way of restricting the find to a single line in the richtextbox.
Any help/sample would be apprichated.
thanks
|
|
|
|
|
You could find the next the carriage return character, the position of that character would give you the length to search.
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
|
|
|
|
|
Thank you that seems such an obvious think to do, I should have thought of it too!!!
however I'm haveing an issue with it in that it alway returns -1 (not found!).
int endline = rtxtResults.Find(System.Environment.NewLine, 1, RichTextBoxFinds.None);
or
int endline = rtxtResults.Find("\r", 1, RichTextBoxFinds.None);
As can be seen above even manualy setting the start location to 1 it never finds the end of line!
the watch show each line ending in \n !
any idea why?
thanks
|
|
|
|
|
An RTB knows about text lines, there are a couple of methods that support that concept,
such as GetFirstCharIndexFromLine() and GetLineFromCharIndex().
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thanks for your pointer I now have it working thus:
int currentline = rtxtResults.GetLineFromCharIndex(rtxtResults.Find(texttofind));
int firstcharinline = rtxtResults.GetFirstCharIndexFromLine(currentline);
int lastcharonline = firstcharinline + rtxtResults.Lines[currentline].Length;
rtxtResults.Select(rtxtResults.Find(nexttextofind, firstcharinline, lastcharonline, RichTextBoxFinds.None), nexttextofind.lenght);
Thanks
|
|
|
|
|
Hi
I m facing a strange problem.Its not a big issue but still want to ask that Is there any way to update list box without against any event ?as I want to show users list in the list box at server side when clients/users successfully conncted but no value is displaying at that time instead I got this message during debugging "The list box is not in a given context".
but if I add any value in list box against any event then it displays.
so plz tell me how i can add values in list box in any context?.
Regards
Shanzay
|
|
|
|
|
Hello,
When I try to build my solution I get following error:
Error 165 Unable to copy file "<dll name="">". The process cannot access the file 'bin\Debug\"<dll name="">" because it is being used by another process.
The <dll name=""> is a project dll of the solution that I am trying to build.
The "Copy Local" property for all the references to above "<dll name="">" is set to false.
I get this error sometimes and when I get it, I have to close down VS.NET and then restart it to get rid of it. It really wastes a lot of time!
Any idea what it can be?
Thanks
|
|
|
|
|
before building ensure that svchost for ur application is running in the task manager i hope this will help u...
dhin chak
|
|
|
|
|
Thanks for replying.
Did you mean <app_name>.vshost.exe?
How do I run it ... Just by double click the
\bin\Debug\<app_name>.vshost.exe?
|
|
|
|
|
I did check that <app_name>.vshost.exe was running but still it gives error!
I see the error at build time, only if I have edited a form in the problem project. In other words, if I edit a form in the project which is giving error, then build the solution, it fails to build and gives the error described in previous posts.
|
|
|
|
|
Hi,
My application(a Windows Service) needs to create a complex xml, the values for which are retrieved from several tables of an oracle db.
In order to construct this, I can use wither datasets(probably typed) or business enitity objects which are XML serializable.
Also, requirement is to only use SPs at oracle end and direct SQL queries are not allowed
What is a better suggestion in terms of development ease and time and also performance. I need to have the design very soon. So please give your experiences in them also
-Rohan
|
|
|
|
|
I always prefer writing objects over strongly typed datasets in all but the most trivial of cases. There seems to be an MS trend to eliminate OO and it always backfires late into a the project.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
hi,
I have been trying to create tablet PC application to do handwriting recognition. We have Tablet PC SDK 1.7 installed and Win XP on a desktop. There is a panel where you can write with the mouse. We have a recognize button and for the button click event we have the following code:
MessageBox.Show(oInk.Ink.Strokes.ToString());
This didn't work and gave a unhandled exeception.
So we tried doing this:
Recognizers oRecognizers =
new Recognizers();
Recognizer oReco =
oRecognizers.GetDefaultRecognizer();
RecognizerContext oRC =
oReco.CreateRecognizerContext();
oRC.Strokes = oInk.Ink.Strokes;
oRC.EndInkInput();
RecognitionStatus iStat =
RecognitionStatus.NoError;
RecognitionResult oResult =
oRC.Recognize(out iStat);
This was the exception we got:
"An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Ink.dll
Additional information: The requested recognizer is not available with the current setup or configuration. "
Could you please tell me what is wrong?
Pls suggest an alternate way to do recognition. Its really urgent!
Pls suggest links where I can find sample working code.
Thanks
Bibhakar Ranjan
|
|
|
|
|
what's your default keyboard layout? google says it should work if it's english (united states)
|
|
|
|
|
Hi.
I need some help with creating a custom resizable contol in C#/XAML.
I am using groupboxes as the "windows" in my application. In the bottom right corner I have made a button that I want to use as a resize handle.
So the button itself needs to be dragable and then the groupbox´s width and height has to follow the button.
Is this the right way to do it?
/B
|
|
|
|
|
Moving the button with the mouse...
> On the button's OnMouseDown event, set a bool flag to true and store both the mouse's current position (MousePosition ), and the buttons current Location .
> On the button's OnMouseUp event, clear the bool flag.
> On the button's OnMouseMove event, (if the bool flag is set) set the button's Location to it's last stored location + the difference between the new MousePosition and the last stored mouse position.
A simple way of resizing the groupbox is setting its AutoSize property to true, and AutoSizeMode to GrowAndShrink. This will resize the groupbox to the location of the button (assuming it is the lowest and rightmost object in the groupbox).
This has always worked for me in the past... although you may want to look at using MdiParents (www.codeproject.com/csharp/mdiformstutorial.asp[^]).
MdiParents have much more to offer (layouts etc) and look more professional.
Hope this helps.
Matthew Butler
|
|
|
|
|
I need drawstring() to print a trailing blank space but it seems to be trimming the string... does anyone know a workaround to this???
|
|
|
|
|
AFAIK Graphics.DrawString() only paints the foreground, i.e. pixels belonging to the
characters in the string, so it does not paint spaces, it just skips them.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
see the prob is that...i need to format numbers such that they are aligned. -ve numbers are denoted in brackets
eg.
5000
(20)
here the nos are not aligned...so i need to print a blank space after the +ve nos so that they align properly.
eg.
5000
(20)
is this possible using drawstring() ??????
|
|
|
|
|
Hi,
Graphics.DrawString() will paint a string at the given coordinates (specified by either
a PointF or two floats, and indicating the top-left corner as always).
So it is up to you to specify the right x-value to get the alignment you want.
There are two possibilities:
1. using a non-proportional font, such as Courier New, where all symbols have the same width:
you can simply keep x constant and adjust the string, i.e. add spaces to the left and/or
the right, so the characters appear where you want them.
2. using an arbitrary font:
since character widths may vary now, you must find out how wide a specific string is,
and then adjust the x-value to get it to align properly.
The width can be obtained from Graphics.MeasureString(). Be careful to specify the
same parameters (text, font, brush, ...) you are going to pass to DrawString() later on.
If you want the unit digits to align, you should split the string in two parts, the left one
ending on the unit digit, the right one holding everything else (could be decimal point,
decimals, and/or a closing parenthesis). Then calculate the width of the left part,
and adjust it's x-value accordingly. The right part will have to be drawn at a constant
x-value, since that one needs to be aligned.
As you can see, with arbitrary fonts, spaces don't really come into the solution.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thanks a lot..
|
|
|
|
|
Hi,
I have created a Local User Account programmatically say "MyUser" and then Iam Creating a process as MyUser. From within this process( which means Iam working as "MyUser") I have created a Pdf file and then Iam trying to open it Programmatically using DOS command "cmd /c start myfile.pdf". But the Pdf file is not getting opened. Even when I click on it. It Says "Access denied". The Same file if I login using "MyUser" it is being opened.Then after If Iam trying to Open it Programmatically or Normally I could open the File from my current user Account.
So,Is it a must for me to login as "MyUser" atleast once to work with that user Programmatically?
What I observed is once I login as that user, In Documents and Settings a folder is created under the name "MyUser".
So Is there any thing more I need to do apart from creating a user Programmatically?
Any suggestions would be helpful.
Thanks in Advance
Today is a gift, that's why it is called the present.
|
|
|
|
|
i had a program that use TAPI methods to answer a call ,it work correctly with SIP TSP and asnswer the call but this programm didnt work correctly in h323 TSP and didnot answer the call , so does h323 support the call answer if yes whats my program problem ???? tank you
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using JulMar.Tapi3;
using QuartzTypeLib;
namespace IncomingSample
{
public partial class IncomingForm : Form
{
public IncomingForm()
{
InitializeComponent();
}
private void IncomingForm_Load(object sender, EventArgs e)
{
_tapiMgr.Initialize();
foreach (TAddress addr in _tapiMgr.Addresses)
{
if (addr.QueryMediaType(TAPIMEDIATYPES.AUDIO))
{
try
{
// Supports audio -- attempt to select video as well if the provider supports it.
TAPIMEDIATYPES mt = TAPIMEDIATYPES.AUDIO;
if (addr.QueryMediaType(TAPIMEDIATYPES.VIDEO))
mt |= TAPIMEDIATYPES.VIDEO;
// Open - this owns inbound calls
addr.Open(mt);
}
catch(TapiException ex)
{
if (ex.ErrorCode == unchecked((int)0x80040004))
{
try
{
addr.Open(TAPIMEDIATYPES.DATAMODEM);
}
catch
{
}
}
else
MessageBox.Show(string.Format("Open(VOICE) {0}: {1}", addr.AddressName, ex.Message));
}
// Add any existing calls.
foreach (TCall call in addr.Calls)
{
lbCalls.Items.Add(call);
}
}
}
}
void OnSelectedCallChange(object sender, EventArgs e)
{
TCall call = (TCall) lbCalls.SelectedItem;
if (call != null)
{
if (call.Privilege == CALL_PRIVILEGE.CP_OWNER)
{
btnAnswer.Enabled = call.CallState == CALL_STATE.CS_OFFERING;
btnDisconnect.Enabled = true;
return;
}
}
btnAnswer.Enabled = false;
btnDisconnect.Enabled = false;
}
private void OnAnswerClicked(object sender, EventArgs e)
{
TCall call = (TCall)lbCalls.SelectedItem;
TTerminal captureTerminal = call.Address.GetDefaultStaticTerminal(TAPIMEDIATYPES.AUDIO, TERMINAL_DIRECTION.TD_CAPTURE);
TTerminal renderTerminal = call.Address.GetDefaultStaticTerminal(TAPIMEDIATYPES.AUDIO, TERMINAL_DIRECTION.TD_RENDER);
foreach (TStream stream in call.Streams)
{
if (stream.MediaType == TAPIMEDIATYPES.AUDIO)
{
if (stream.Direction == TERMINAL_DIRECTION.TD_CAPTURE)
stream.SelectTerminal(captureTerminal);
if (stream.Direction == TERMINAL_DIRECTION.TD_RENDER)
stream.SelectTerminal(renderTerminal);
}
}
try
{
call.Answer();
}
catch (Exception ex)
{
// MessageBox.Show(ex.ToString());
}
}
private void OnDisconnectClicked(object sender, EventArgs e)
{
TCall call = (TCall)lbCalls.SelectedItem;
try
{
call.Disconnect(DISCONNECT_CODE.DC_NORMAL);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void IncomingForm_FormClosed(object sender, FormClosedEventArgs e)
{
_tapiMgr.Shutdown();
}
private void OnCallStateChange(object sender, TapiCallStateEventArgs e)
{
if (e.Call.Privilege == CALL_PRIVILEGE.CP_OWNER)
{
lbCalls.Items.Remove(e.Call);
if (e.State != CALL_STATE.CS_DISCONNECTED)
lbCalls.Items.Add(e.Call);
}
}
private void OnNewCall(object sender, TapiCallNotificationEventArgs e)
{
if (e.Call.Privilege == CALL_PRIVILEGE.CP_OWNER)
lbCalls.Items.Add(e.Call);
}
|
|
|
|