|
Just app.config will be enough!
bin\Debug\DataLinq.dll.config is a copy of app.config made by VS on build success.
application settings are written to the app.config as well (in settings you can choose application or user)
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I add two splitconrainers. The panel at the topmost will have a problem. The top region of Panel will be covered by toolstrip. But I woudl to draw some thing like pixture to fill the Panel. How do I modfy this problem to prevent the panel covered by toolstrip?
http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/Visual%20C%7C3/VC%7C3%7C_spliContainer%7C_dosck%7C_region.jpg
You can the jpg file, the top region of the topmost panel is covered with toolstrip.
|
|
|
|
|
Hi,
Is this just a problem with the way you have constructed the form in the designer? With docking controls you really need to start at the outside and work in towards the middle.
1) Form
2) menu strip
3) tool strip
4) split container.
Alan.
|
|
|
|
|
When this sort of thing happens, simply right-click on the control that is partly hidden and from the context menu that appears click Bring To Front.
Problem Solved!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi,
I m using MS-Index Services, everything doing well
But i want to Retrieve Office Document(doc,xls)html etc Metadata
means some text area just like google web site Result.
somebody help me for configuration and query for retrieve documents text part.
|
|
|
|
|
I want to remove the http response header using regular expression
for example the following is the response i get
-----------------------------------------------
HTTP/1.1 200 OK
Date: Fri, 07 Aug 2009 18:10:29 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 140
Connection: close
Content-Type: text/html
A Word a Moment
Word : somber
Pron : sombu(r)
Meaning :
1. Lacking brightness or colour; dull
Example : (empty)
---------------------------------------------------
and i need only the text after "A word a moment"
so i thought of this code which is not as expected
string outs = Regex.Replace(cont, "^.*\r\n\r\n", "", RegexOptions.Multiline);
what could be the pattern to remove the http response header so that i can just use the actual response?
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
I think it would be easier for you if you don't use a regexp. You can simply drop all the header, directly when reading from the socket's stream.
If you can only have the full text in a string (for example if you are using a third-party library and cannot modify the code which reads from the socket), then you can parse it and find the beginning of the text you need.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
sure. but i thought i can include the knowledge of using regex with win32. actually i already have a program written in win32 api which is working well. in that i used strpos to find the two \r\n\r\n to find the end of the response header. coding in win32 api to accomplish my need gets tedious so i am writing the same program in c#. instead of the old way i thought of trying new. anyway do you know how to read the response body using any of System.Net.Sockets ? ... and the program is here ... http://vikku.info/wordreminder/[^]
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Ok I see. Well, if you want to use regexps, the easiest way I can think of is something like:
string HttpText = "HTTP/1.1 200 OK\r\nDate: Fri, 07 Aug 2009 18:10:29 GMT\r\nServer: Apache
/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimi
ted/1.4 FrontPage/5.0.2.2635 PHP/5.2.8\r\nX-Powered-By: PHP/5.2.8\r\nContent-Length: 140\r\
nConnection: close\r\nContent-Type: text/html\r\n\r\nA Word a Moment\r\nWord : somber\r\n\r
\nPron : sombu(r)\r\n\r\nMeaning :\r\n1. Lacking brightness or colour; dull\r\n\r\nExample
: (empty)\r\n\r\n";
Regex MyRegex = new Regex("\r\n\r\n");
String[] MyStrings = MyRegex.Split(HttpText, 2);
if (MyStrings.Length != 2)
{
throw new ApplicationException("Error parsing HTTP response!");
}
Console.WriteLine("Header:");
Console.WriteLine("-------");
Console.WriteLine(MyStrings[0]);
Console.WriteLine("Body:");
Console.WriteLine("-------");
Console.WriteLine(MyStrings[1]);
Console.WriteLine("-------");
But it doesn't make much sense to use the Regex object here, since the pattern separating header from body is a fixed string ("\r\n\r\n"), so the same can be done using String.Split() , which is simpler and more performing.
If you want to use Regex.Replace() , like in your example, then you will have to limit the number of matches to replace to one, otherwise ALL matches will be replaced with the empty string! See the docs here[^].
Regarding how to read data from a socket, if you check the docs for objects in System.Net.Sockets , like TcpClient[^], you'll see they expose methods to obtain a NetworkStream[^], which you can use to read data.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Excellent. thank you for your needful reply. the tcpclient will help for now and also i will tinger with the others. i had a quick view of your links and i have to spend more time on that.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
My pleasure, good luck.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hello,
I am creating a GUID and then using that ID inside a SQL statement. I get an error saying that incorrect syntax near '-' , and I believe its referring to the dashes that are created with the GUID. So i was going to split up the GUID and just make it a string of characters. Can anyone help me do this? BElow is a little bit of code to show how I'm using it. Thanks for your help!
SqlConnection sqlConn = new SqlConnection("Data Source=localhost;Initial Catalog=Cost_Model;Integrated Security=True");
sqlConn.Open();
System.Guid UID = System.Guid.NewGuid();
Int16 SCENARIOID = 1;
SqlCommand sqlComm1 = new SqlCommand(
"INSERT INTO web_far15 select " + UID + ", * from fn_far15(" + SCENARIOID + ")",
sqlConn);
SqlDataReader r = sqlComm1.ExecuteReader(CommandBehavior.CloseConnection);
Session["TableName"] = "web_far15";
Session["SessionID"] = UID;
r.Close();
Thanks again for your help!
|
|
|
|
|
Ummm... what? If you provide the GUID as a string SQL Server will parse it.
SELECT * FROM table WHERE ID='blah-blah-blah...'
I don't know whether or not other databases will.
But you'd have an even easier time using a parameterized statement.
|
|
|
|
|
All I did to get the GUID was
System.Guid UID = System.Guid.NewGuid();<code> which created the code.<br />
<br />
When I try to pass the GUID directly it does not allow it, I get the '-' error explained above. Its also not letting me typecast it to a string.
|
|
|
|
|
Parse it with what? Why do you need to parse it?
System.Guid has a constructor that will do it. SQL Server will do it. But you shouldn't need to do it at all.
|
|
|
|
|
I believe I need to parse it so I can take out the dashes. When I run the code, I get the error "Incorrect syntax near '-'." and it breaks at SqlDataReader r = sqlComm1.ExecuteReader(CommandBehavior.CloseConnection);
So when I read that, that sounds like I need to take out the dashes. Am I incorrect?
|
|
|
|
|
0) Put the GUID in apostrophes if you insist on writing poor SQL.
1) Use a parameterized query to write good SQL.
|
|
|
|
|
I am trying to retrieve the contents of multiple textboxes using a for loop as follows:
for (int x = 1; x < 6; x++)
{
string vDate = "txtDate" + x + ".Text"; // vDate = txtDate1.Text on 1st iteration
string vFund = "txtFund" + x + ".Text";
string outDate = vDate; // this should = txtDate1.Text on 1st iteration
string outFund = vFund;
}
When I run the code outDate = txtDate1.Text and outFund = txtFund1.Text. How do I set variable to equal the text contents of the textbox? Any help would be appreciated.
Thanks
|
|
|
|
|
Instead of just outputting C# code in text file better leverage C# ability to write code that in turn output code for you. You can then execute that outputted code. I am taking about code dom feature of C#
|
|
|
|
|
private void DoSomethingWithATextBox(TextBox textBox){
}
...
DoSomethingWithATextBox(txtDate1);
DoSomethingWithATextBox(txtDate2);
DoSomethingWithATextBox(txtDate3);
DoSomethingWithATextBox(txtDate4);
DoSomethingWithATextBox(txtDate5);
DoSomethingWithATextBox(txtDate6);
Much easier than doing the loop method which will be dependent on proper code generation. Also, the loop method is available in ASP.NET but I still don't like it. My method is much cleaner and easier to maintain.
|
|
|
|
|
Hi,
two easy ways:
1.
use a List<TextBox> textboxes to which you add the textboxes of interest, then a simple foreach(TextBox tb in textboxes) will do the job.
2.
if you want to enumerate ALL the textboxes of a Form, and they all are at the top level of that form, you could do:
foreach (Control c in this.Controls) {
TextBox tb=c as TextBox;
if (tb!=null) { ... do something to tb ... }
}
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Anyone got a good idea as to how I can monitor the number of times my application is actively running on various PCs across a network. I want to licence my product based on concurrent usage, therefore allow it to be installed on any number of PCs on a newtwork, but perhaps only allow ten instances to be running/accessed at the same time. My app does not use a database, therefore preventing me monitoring the number of logged in connections. I suppose I could place a file in a shared location, but would rely on the application have the rights to update the file, and not making it obvious to users that this file monitors the number of active instances. Neither can I guarentee the network admin will allow a socket server type application to be installed allowing each program to connect as a client.
The reason for this query is that I'm not too keen on having to enforce users or company to register a product key based on the PC's MAC address (or something simplar) for each PC it's installed on, but if this is the best approach, then this is the approach I'll take.
Any ideas on a possible way forward??
Andy
|
|
|
|
|
Run a licensing server. Require each allowable instance to have a key (either Software Key or a FOB) and then check it intermittently in code. Disconnect the oldest client just like your ISP will do. (It was fun back in the day to set my own IP address and boot people off Earthlink)
|
|
|
|
|
Hello there,
I've got a typical Form called Form1 with some UserControls including a DataGridView (called dgView) inside a TabControl.
The dgViews are databound to datatables which for themselves can alter their values.
The dgViews always and to every time should show the content of these datatables. So I wrote the methods ActualizeView1() and ActualizeView2() which puts the rows inside the dgViews into different colors. I call these methods each time these lines have to be redrawn.
I don't know which funktion does this or why but I know that after c'tor Form1() did its job view1_Load(...) is called before Form1_Load(...)
view2_Load(...) is only called when I click on the tabPage2 so the contents inside are to be drawn.
So I called ActualizeView1() out of view1_Load(...) and ActualizeView2() out of view2_Load(...)
The problem still is: When I click on the tabPage2, the contents inside view2 do not have the color that they should. Every row in the dgViews must have a color (NOT black), but they are ALL black - like I only would have bound the datatables but not given them colors.
When I ActualizeView2() again the colors are correct.
So the question is: When do I have to call my method ActualizeView() in order to get the proper colors? Or is there s.th. that puts the rows back in black from view2_Load(...) or from elsewhere?
Thanks in advance
Harry
no plan,
no signature
|
|
|
|
|
You could handle the TabControl.SelectedIndexChanged event something like this:
private void tc_SelectedIndexChanged(object sender, System.EventArgs e)
{
TabControl tc = (TabControl)sender;
if (tc.SelectedTab == view1Tab)
{
ActualizeView1();
}
else if (tc.SelectedTab == view2Tab)
{
ActualizeView2();
}
etc.
}
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|