|
thank you guys
good coding
|
|
|
|
|
DA1 = new SqlDataAdapter("select * from tbmohasebe where tarikh = '"+comboBox1.Text +"'" , conn1);
DA1.Fill(dt1); //dt1 is Data table
dataGridView1.DataSource = dt1;
how can i hide some of columns in datatable that don't show in datagrid?
|
|
|
|
|
Use a specific select list...
select field1, field2, field3 from Table where blah blah blah...
Visit BoneSoft.com
|
|
|
|
|
Isn't this working ?
dt1.Columns.Remove("columnName");
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
On load of your form or in any another event u can add code down below
dataGridView1.Columns[index].Visible = false;
//indexn is index of column which u want to hide in dataGridView
|
|
|
|
|
I created an mdi form, and then added three children to it.
When I click on any child form it becomes the active one and its title becomes bluish to indicate that.
The issue that I have is that when I click on any child form via right mouse click, I am not able to get that form to be the active or the selected form. How can I activate a child form via right mouse click only?
Thanks.
|
|
|
|
|
I have written a Windows Service which creates multiple threads. Each thread listens on a seperate port, writes received messages to disk and acknowledges the receipt of each message. It works perfectly with a single thread so I started load testing multiple threads with disapointing results. I've noticed erratic behavior and am pretty sure its due to the multi-threading. This is my first true multithreaded app and wanted to get some pointers. My Windows Service basically just creates (with ThreadPool.QueueUserWorkItem) and stops the threads as necessary. The rest of the code (Listening and responding, storing port numbers and directory paths, writing messages to disk) is contained in a DLL shared by each thread.
So first question is:
1. Is what I'm attempting to accomplish possible, or is it going to be a locking nightmare ?
The reason I ask is that it appears I need to lock the listening loop since it is contained in a DLL used by each thread. But won't this effectively stop the rest of the the threads from listening to their ports since it is blocking?
Do I need to ditch the idea of listening on multiple ports within threads and just have multiple instances of the same app on a server ?
Any help would be appreciated.
|
|
|
|
|
You know, it might help to look at this article[^].
It looks kinda like what you're trying to do...but it seems like he's done all the hard work for you.
Once you wanted revolution
Now you're the institution
How's it feel to be the man?
|
|
|
|
|
Hello,
I try to write these characters to an XML file. but in the XML file it shows:
> < & instead. how can i write correctly to the XML file or at least read correctly(assign the innertext to a variable)?
here is my code for writing to XML file:
XmlElement title= xmldoc.CreateElement("Title");
title.InnerText = txtName.Text;
newBook.AppendChild(title);
Donkaiser
|
|
|
|
|
haha but in the XML file it shows:
& gt; & lt; & amp; instead. So confusing!!!
Donkaiser
|
|
|
|
|
there are some characters that has special meaning in html/xml files, for example <, >, & and so on. So, if you need to display such character in xml/html file you should use one of the special form of symbol writing, for example '&' followed by character short form and followed by ';'. '&' gt ';' for 'greater' sign.
When you are reading html/xml file you have to decode such symbols.
In your case, if you have only this three symbols in your file - you can make simple replace, either through string.replace(), either through regex.replace(). But if you can get more symbols (probably, all special chars) - then use standart functions - parse xml file into set of xml element object (or any other way) and read it's InnerText property.
Notice, that if you'll write special chars into InnerText, and read it from it - It'll be ok.
XmlDocument doc = new XmlDocument();<br />
doc.LoadXml("<root>" +<br />
"<elem>some text<child/>more text</elem>" +<br />
"</root>");<br />
<br />
XmlElement elem = (XmlElement)doc.DocumentElement.FirstChild;<br />
elem.InnerText = "testing < > &";<br />
MessageBox.Show(elem.InnerText);
MessageBox shows "testing < > &"
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
Using innerText format automatically the text.
Donkaiser
|
|
|
|
|
I'm stuck on this one, really bad.
Exact Error Message:
An unhandled exception of type 'System.Security.SecurityException' occurred in CheckPageUpdates.exe
Additional information: Request failed.
If I run my application from my local box it works perfectly. If I run the app off of the Network it fails giving the above error message.
Now I know what this issue normally is, it's about not having your Machine->LocalIntranet_Zone setup to allow your program to run with enough rights. So I created a key using sn and added it to the assembly, built my program, then i loaded the key into my Machine->All_Code by adding another group and give it full permissions. This seemed to solve nothing. My program has about 10 lines and it communicates with a webservice which I also wrote.
CODE:
static void Main() <br />
{ <br />
new CheckPageUpdates();<br />
}<br />
<br />
public CheckPageUpdates()<br />
{<br />
try<br />
{<br />
PageModified.PageModifiedService pms = new PageModified.PageModifiedService();<br />
<br />
string strAddress = pms.CheckPageUpdated(Environment.GetEnvironmentVariable("username"));<br />
<br />
if(strAddress != string.Empty)<br />
{<br />
Process iexplore = new Process();<br />
<br />
iexplore.StartInfo.FileName = "iexplore.exe";<br />
iexplore.StartInfo.Arguments = strAddress;<br />
<br />
iexplore.Start();<br />
}<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString()); <br />
}<br />
}
What this does is it hands off the username of the currently logged in user to the webservice which then checks to see if this user has seen a webpage recently enough or if they need to see it again. It then returns a web address, or string.Empty, depending on whether or not they should load a page.
When the code fails and I load the debugger it shows me that it failed at the bolded underlined point.
Thanks a bunch for at least reading this
--Peter
|
|
|
|
|
In my experiencing, certain operations (especially those relating to files / directories) are not allowed or require extra security permissions to use in .NET.
At an educated guess:
string strAddress = pms.CheckPageUpdated(Environment.GetEnvironmentVariable("username"));
is probably causing it.
To suppress it you will need to have your application request additional permissions. This is done through the System.Security namespace, but I am unsure to the specifics of it.
Hopefully I have given you enough information to googlise
James
just-code-it.net
|
|
|
|
|
I tried adding the following to lines in my code file, but I had not change.
<br />
[assembly:EnvironmentPermissionAttribute(SecurityAction.RequestMinimum, Read="USERNAME")]<br />
[assembly:FileIOPermissionAttribute(SecurityAction.RequestMinimum, All="C:\\Program Files\\Internet Explorer\\iexplore.exe")]
I feel like i'm on the right track, but i'm not sure.
--Peter
|
|
|
|
|
Patricker wrote: SecurityAction.RequestMinimum
You need to Demand it
|
|
|
|
|
If i use demand on either of them then it won't build anymore.
I get the following build error:
Assembly generation failed -- SecurityAction type invalid on assembly.
So I guess I can't demand it...
--Peter
|
|
|
|
|
Sometimes it does not let you at all.
Once I wanted to loop through a certain portion of the HD (forgotten why) but no matter how many sec permissions i got, it wouldnt let me do it.
Either because of a performance lag on computer or some sensitive files...
If your project sounds like it could provoke .NET in any of these areas, try changing it.
This is probably not the case, but worth a shot
|
|
|
|
|
hello,
I am creating a windows form app using VS.Net and I am having a fundamental problem with window sizing. I would like to specify the exact size of each form programmatically. Despite my efforts, the forms seem to be resizing themselves sometime between when the constructor is run and the window is actually displayed. Does anybody know why or where in the code this is happening? Any insight would be much appreciated.
Thanks!!!
rc
|
|
|
|
|
It may be that you are putting your programmatical assignment of the size before the InitialiseComponent() method in the form's constructor is being called, as a result the assignment to the form's size in InitialiseComponent() is overriding your assignment.
James
just-code-it.net
|
|
|
|
|
Does anyone know what's the equivalent of SelectedIndexChanged(object sender, System.EventArgs e) event of Win form ComboBox control in UltraCombo in Infragistics control. I want to raise a event only when UltraCombo value changes.
thanks
Share knowledge to enhance your learning
|
|
|
|
|
hi guys..
i've never faced with a problem like this, just want to ask u guys..
i declared a datetime component ..
<br />
DateTime x = new DateTime(1900,01,01,7,0,0,0);<br />
everything is fine.. let`s write it to a textbox name tBox;
<br />
tBox.Text = x.toLongTimeString();<br />
everything is ok.. i get 7:00:00
but after i add some minute to this instance..
<br />
x.AddMinute(15);<br />
tBox.Text = x.toLongTimeString();<br />
why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?!
any thoughts ?
thanx
good coding
|
|
|
|
|
You have to assign the return value of AddMinute to your variable x. x itself isn't changed.
x = x.AddMinute(15);
tBox.Text = x.toLongTimeString();
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
thanx a lot..
good coding
|
|
|
|
|
Hi,
Iam using datagridview,How to add a new row to the datagrid view?
In insert button i wrote this code,
dataGridView1.Rows.Add(3);
when i run this code,it is giving the following exception
exception: rows cannot be programatically to the datagridview's collection when control is databound
In save button i wrote like this,
private void button1_Click(object sender, EventArgs e)
{da.Update(ds,"emp");
}
It is giving the following exception:
Update requires a valid InsertCommand when passed DataRow collection with new rows.
Please help me.
Thanks In Advance
|
|
|
|