|
mikemilano wrote:
I was having trouble with the string.Split() method. I thought It returned a character array .. but I could be wrong.
Well, it takes a character array containing delimiter characters as an input parameter and returns a String array, this means that the example from my previous post would return an array containing 6 items, i.e.
strArray[0] - "Here"
strArray[1] - "is"
strArray[2] - "my"
strArray[3] - "string"
strArray[4] - "hello"
strArray[5] - "world!"
(as we have specified space and comma as delimiter characters.)
Rado
|
|
|
|
|
thank you , .. this really clears things up a lot.
i was trying to send it a string.. and not a character array.
i really do appreciate all the help!
|
|
|
|
|
Hi,
I have built a simple applicaton that accesses an XML file located on a remote web server using the XmlTextReader class. The application works flawlessly on all my machines, but throws the following exception when ran on my friend's PC (this is the Message property of the Exception):
Request for the permission of type System.Net.WebPermission, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
I've been looking for differences between our machines and I've found that when I run the Microsoft .NET Framework 1.1 Configuration from Administrative Tools, and select the "Evaluate Assembly" from the "Runtime Security Policy" node, on my machine the list contains only one item - Unrestricted, whilst on my friends machine it contains a longer list which does not contain "Web access" permission. I guess that this is the reason of the application's inability to access the resource (the remote XML file). I guess his OS is Windows XP, I am using Windows 2000.
And here I am stuck. I didn't find a way how to configure application/assembly permissions using the .NET Framework Configuration on my machine (I was trying to remove the "Web access" permission for this application on my PC) and also I don't know how to add the "Web access" permission on my friend's PC.
Does anyone have a clue how this can be achieved? Thanks a lot in advance.
Rado
|
|
|
|
|
Well, howto particularly approve this permission I am not aware of. But go to administration tools/.Net Wizards/Adjust .Net security, and you will be able to change your permissions settings.
Gooky
|
|
|
|
|
I want to connect dataset table (returning dataset form a web services) with a table in a datagrid. The problem is I just want to use a selected amount of columns from the dataset.
Any ideas would be appreciated
Thanks
|
|
|
|
|
Are you autogenerating the columns in the datagrid?
Just so I understand. You are populating the datagrid with one dataset and want to add another dataset (from a webservice)?
Have you look at the merge method?
|
|
|
|
|
You need to create your to add a table styles object to the tablestyles collection. This will allow you to specify column mappings and so on. Of course you could set the width to 0 and that would also hide them
This way is better in that you can create custom columns like check bools combos and what not
example:
DataGridTableStyle newStyle = new DataGridTableStyle();
newStyle.MappingName = "CCheckInList"; // This is the name of the table
newStyle.ColumnHeadersVisible = true;
DataGridTextBoxColumn gridColumn = new DataGridTextBoxColumn();
gridColumn.MappingName = "Dispatcher"; // This is the column name
gridColumn.NullText = "Must Assign";
gridColumn.HeaderText = "Dispatcher";
gridColumn.Width = 100;
newStyle.GridColumnStyles.Add(gridColumn);
TableStyles.Clear();
this.TableStyles.Add(newStyle);
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
custom table mappings is the answer for a 100
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
does anyone know how i can detect the position of the cursor in a richtextbox control?
i have a text file that is displayed in the rtb control and i want to determine what the line and character position of the cursor is.
ANY help on this is appreciated.
thanks.
|
|
|
|
|
int myLine = rtf1.GetLineFromCharIndex(rtf1.SelectionStart);
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Thanks for your help. This was just enough to get me started.
I had no idea there was actually a method for this...i guess i should have looked at msdn first.
btw, experts are those who never admit it.
i appreciate your help.
|
|
|
|
|
not in a job interview if your a consultant.
the easiest way to find the methods, propertiesw, and events is to hit <f2> for your object browser. Thas how I found it.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Does anyone know if there's a Windows.Forms Control aviable I can use to create graphs (like SCPL), which has the possibility to set the axes in the center (not just Y-axis all-left and X-axis on the bottom)? I need to use it to draw math functions (very simple ones, form y=ax+b), but all controls I can find put the Y-axis on the left and the X one on the bottom :S. Being able to display points on integer positions (like (1,1),(1,2),(2,3),(-1,-5),(-1,6) and so on) would be a plus.
Thanks, Ikke
|
|
|
|
|
Well
int axisX = this.Width/2;
int axisY = this.Height/2;
a line with x and y
MoveTo(x+axisX, y+axisY);
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Mmm, you mean this little piece of code to write my own control? I can figure this out myself (really true LOL), but I doint know GDI+ (and Im too lazy LOL)
|
|
|
|
|
GDI is easier than kindergarten. DirectX and 3D is another story altoghter
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I have a new version of an assembly which is refereneced by my client application. I configured "Binding Policy" with ".NET Framework Configuration" tool - but the client is still referencing the old assembly.
I then tried to get around this temporary by configuring a Publisher Policy Assembly and gacutil -i the policy to GAC. No crash, but again, the client is referencing the same old package. I am sure I checked the "Enable Publisher Policy" checkbox before I install the policy assembly to GAC...
Can anyone tell me what are the common screw-ups for in assembly redirection? Thanks.
norm
|
|
|
|
|
Hi!
Can anybody imagine why a thread doesn't start when I execute the program within the VisualStudio .NET 2003 environment.
When I execute this exe in the command-shell everything works fine. (even with mono and linux).
This only happens with a certain project.
Any ideas ?
THANKS !!!!!!
|
|
|
|
|
Please post some code.. It'll be easier for us to help you.
|
|
|
|
|
Hi All,
I've never done any multi-threaded programming before and I'm having trouble getting some code to work as I want it to. Here's the situation: I have a POP3 client that I wrote (in a dll) and in the program that I'm using it from I want the user to click "Connect" (a button) to connect to the server. When they click connect it changes it's text to "Disconnect" and if they click it in that state it should disconnect from the server (even if it's in mid connection). I really have no idea how I should be going about this so any help would be greatly appreciated.
Thanks in advance
- monrobot13
|
|
|
|
|
If you can, keep have a variable that indicates whether or not to stop the operation, and keep checking that variable in the worker thread. But this is obviously not always possible. The other way to do it is to call Thread.Abort() on the worker thread. When you call Thread.Abort, the thread will get a ThreadAbortException. Handle the exception, and clean up any resources and close any connections before exiting.
try
{
}catch(Exception e)
{
}
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Should variables I need to use in a thread be static? I ask because this is what I'm trying to do:
Thread myThread = new Thread (new ThreadStart (ThreadFunc));
if (button1.Text == "Connect")
{
myThread.Start ();
button1.Text = "Disconnect";
}
else
{
popClient.DestroyConnection ();
button1.Text = "Connect";
myThread.Abort ();
myThread.Join ();
}
public void ThreadFunc ()
{
Networking.PopClient popClient = new networking.PopClient (cboServer.Text, txtUser.Text, txtPassword.Text);
bool bConnected = popClient.CreateConnection ();
if (!bConnected)
{
lblError.Text = popClient.LastError;
return;
}
int count = popClient.GetMailBoxCount ();
int size = popClient.GetMailBoxSize ();
lblMessageCount.Text = Convert.ToString (count);
lblQuotaUsed.Text = Convert.ToString (size);
} Like the comment there says, how can I use the popClient variable in both main and the threadfunc? So my other question (again like the comments say) is why isn't the thread started?
Thanks again for the help
- monrobot13
|
|
|
|
|
monrobot13 wrote:
Like the comment there says, how can I use the popClient variable in both main and the threadfunc?
It doesn't have to be static, but it can't be accessed while another thread is accessing it, or you'll get an InvalidOperationException.
I would suggest doing the popClient.DestroyConnection (); in the finally block in your ThreadFunc() procedure. This way, only your worker thread needs to use popClient during its lifetime.
Thread myThread = new Thread (new ThreadStart (ThreadFunc));
if (button1.Text == "Connect")
{
myThread.Start ();
button1.Text = "Disconnect";
}else{
myThread.Abort ();
myThread.Join ();
}
public void ThreadFunc ()
{
Networking.PopClient popClient = new networking.PopClient (cboServer.Text,
txtUser.Text, txtPassword.Text);
try{
bool bConnected = popClient.CreateConnection ();
if (!bConnected)
{
lblError.Text = popClient.LastError;
return;
}
int count = popClient.GetMailBoxCount ();
int size = popClient.GetMailBoxSize ();
lblMessageCount.Text = Convert.ToString (count);
lblQuotaUsed.Text = Convert.ToString (size);
}catch(Exception e){
}finally{
popClient.DestroyConnection();
OnFinished();
}
}
public event EventHandler Finished;
protected OnFinished()
{
if(Finished!=null)
Finished.BeginInvoke(this,EventArgs.Empty,null,null);
}
private void JobFinished(object sender, EventArgs e)
{
button1.Text = "Connect";
}
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I'm using the following code to capture a screenshot :
Image myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics gr1 = Graphics.FromImage(myImage);
IntPtr dc1 = gr1.GetHdc();
IntPtr dc2 = GetDC(GetDesktopWindow());
BitBlt(dc1, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, dc2, 0, 0, 13369376);
gr1.ReleaseHdc(dc1);
GC.Collect();
return myImage;
I'm trying to capture a screenshot of the entire desktop and transferring it to a remote PC (to create a program like PcAnywhere). The thing is, i set my screenshot timer to something like 450 ms and on my machine (Athlon XP 2000+), it uses up around 30% of the CPU power. However, if i test it on my old P3-700 Mhz machine, the CPU utilisation is very high, ranging between 75-90%.
Is there any way to reduce the CPU utilisation (maybe like reducing the color depth of the image? but how)?
|
|
|
|
|
You should be releasing the DC you get with GetDC() , using ReleaseDC() , and if you aren't going to be using gr1 anymore, you should call Dispose() on it.
What's making it slow is probably the transfer, not the capturing. I don't know if this will make it faster, or slower, but you could make a new Bitmap with a lower color depth, create a Graphics from it, and use Graphics.DrawImage() to draw the image onto the new Bitmap .
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|