|
Hiii all.............
I think u don't mined to help me at project of ...
How i can represent an image, voice & vedio trafic after we capture it
(using SharpPcap)from the application layer at TCP ???
|
|
|
|
|
I don't understand this at all. What are you asking ? How to render it, or how to send it across the network, or something else ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello everyone
I want a fully editable, DB interacted data grid view.
By some mystake, the system has multiple DB's and I cannot use the interface. I have to enter the code to call a table from a specific database, I don't ask how can I fix this, we got along together well until now
I made this data grid view editable, that user can add rows and edit info on the table.
My questions are
-How can I call a table from database to view in this grid view
-How can I save the table's final state? (this is a single usered non-online system so performance is not issue, I can appreciate a solution that drops the previous table and creates a new one with the edited data grid view)
Thank you
|
|
|
|
|
-How can I call a table from database to view in this grid view
SqlDataAdapter SQL_Adapter;
DataTable dtReport1 = new DataTable();
string SQL_Command = "SQL STATEMENT GOES HERE"
SQL_Command += "'" + strExecutive + "', '" + strToolClass + "'";
try
{
using (SQL_Conn = new SqlConnection(WhatIsTheSQLConnectionString))
{
if (SQL_Conn.State != ConnectionState.Open)
{
SQL_Conn.Open();
}
else
{
SQL_Conn.Close();
SQL_Conn.Open();
}
using (SQL_Adapter = new SqlDataAdapter(SQL_Command, SQL_Conn))
{
SQL_Adapter.Fill(dtReport1);
dgvReport.DataSource = dtReport1;
dgvReport.Refresh();
gbToolStatusBoard.Refresh();
}
SQL_Adapter.Dispose();
}
SQL_Conn.Close();
}
catch
{ return; }
-How can I save the table's final state? (this is a single usered non-online system so performance is not issue, I can appreciate a solution that drops the previous table and creates a new one with the edited data grid view)
For this method you would simply export the datatable directly back to the main table after flushing out the data in the origional table.
|
|
|
|
|
oh thank you, I'll give it a try
|
|
|
|
|
Hello,
how can i run or create an instance of a class, which runs in a sandbox (so have no access to the filesystem and so on) and is only able to communicate over for example my host application over an api?
The api and so on is no problem, that is already implemented, but the problem is to restrict all those access...
Has somebody any idea for doing this?
Thanks
|
|
|
|
|
I don't know if you'll be able to do everything you've described, but you could probably try loading the assembly with various permissions. I'm not certain how you would go about this though.
|
|
|
|
|
If the classes in the Assembly wants to access the system I don't think you can stop it.
|
|
|
|
|
{"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"}
im passing int value in CR.
mine string value is working but not INTEGER.
HELP!!!!!
|
|
|
|
|
This code converts from string to index
String strIndex = "12";
Int32 nIndex = Convert.ToInt32(strIndex);
|
|
|
|
|
1. crParameterDiscreteValue.Value = Convert.ToInt32(txtRecptNo.Text) - 1;
2. crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
3. crParameterFieldDefinition = crParameterFieldDefinitions["recpt"];
point no. 3 gives that error.
|
|
|
|
|
{"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"}
3. crParameterFieldDefinition = crParameterFieldDefinitions["recpt"];
Maybe there is no parameter named "recpt" ?
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Hello!
I'm working on an application wich will alow the user to add and remove controls. I want to apply different rules to textbox and this rules will be different for every textbox. For example i want to check wich control has been clicked by using a click event. Because i don't know how many textboxes will the user create i've decided to go along with the code below:
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control ctrl in Controls)
{
ctrl.Click += new EventHandler(ctrl_Click);
}
}
void ctrl_Click(object sender, EventArgs e)
{
}
Is there anyway that i can get the name of the control that has been clicked? The sender.Tostring() only returns the type and the text of the control.
Thanks!
|
|
|
|
|
Yes, what you want to do is cast the sender to a Control such:
void ctrl_Click(object sender, EventArgs e)
{
Control contol = sender as Control;
if (control != null)
{
string name = control.Name;
}
}
Regards,
Rob Philpott.
|
|
|
|
|
Hi.
void ctrl_Click(object sender, EventArgs e)
{
if (sender.GetType() == typeof(TextBox))
{
string name = ((TextBox)sender).Name;
}
}
should work. Also if you are only interested in handling clicks for textboxes you could change the foreach loop to:
foreach (Control ctrl in Controls)
{
if (ctrl.GetType() == typeof(TextBox))
{
ctrl.Click += new EventHandler(ctrl_Click);
}
}
If it' stuck, DO NOT pull harder!
|
|
|
|
|
do NOT compare strings to check for a type, instead use the appropriate keywords:
do NOT compare types, nor strings representing types, instead use the appropriate keywords:
if (sender is TextBox) log("this is a TextBox");
TextBox tb=sender as TextBox;
if (tb!=null) log("this is a TextBox");
it is both faster and more correct as it also matches derived types.
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
modified on Saturday, November 28, 2009 7:37 AM
|
|
|
|
|
According to MSDN help -GetType and typeof returns System.Type, i totally agree with "if (sender is TextBox)".
A humble question, do you mean that GetType()==typeof compiles as a string comparizon?
else i dont understand the "do NOT compare strings to check for a type, instead use the appropriate keywords"
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Sorry, I should have said "do NOT compare types, nor strings representing types, to check for a type, ..."
is/as are more efficient than GetType constructs
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
ok! Thanks Luc, for a split second i thought you were wrong, i should have known better
If it' stuck, DO NOT pull harder!
|
|
|
|
|
Ah, now that's signature material!
|
|
|
|
|
|
Some ideas that may (I hope) bear on your solution :
Is it the case that any TextBoxes are inside containers within the Form (nested) : in that case you are going to need to recurse to find them and attach an Event Handler.
Unfortunately to get the Form.ControlCollection into a "flattened" IEnumerable where you can do cool filtering with Linq, and just, for example, pull out all the TextBoxes into a nice List<>, takes some voodoo which I am just now exploring myself, so am reluctant to comment on that so far.
If TextBoxes are the only controls you want to put a special Event handler on, it seems like overkill to add a subscriber to the 'Click event of every control on your Form or whatever (unless, of course, they are all TextBoxes).
foreach (Control candidate in Controls)
{
if(candidate is TextBox)
}
The TextBox does expose an 'Enter event, and when that event is fired, you can be sure that the 'sender parameter inside that event is also the same as your MainForm.ActiveControl. That might be something you could exploit.
If you are maintaining an arbitrary collection of TextBox controls which the end-user has the power to create and/or remove, you might consider keeping a List<TextBox> up to date, and, possibly a TextBox currentTextBox variable: these may come in handy.
Assuming by "apply different rules to TextBoxes" you mean execute some code for one class of TextBoxes, and execute different code another class of TextBox you could consider a Dictionary of <TextBox, Action<Control>> as found in the very interesting answer by Nathan W. here : [^] which uses recursion in a very clever way.
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Hi guys im creating a folder then adding a user with permissions to that folder but how
do I then set this security permission to apply to this folder, sub folders and files within this folder?
currently it just applys to this folder only.(so when the app creates a file within this folder the file does not inherit the permission's from the folder)
DirectorySecurity dirSec = Directory.GetAccessControl(_dbPath);
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.Write, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.ReadAndExecute, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.CreateFiles, AccessControlType.Allow));
dirSec.AddAccessRule(new FileSystemAccessRule(IdentityReference, FileSystemRights.WriteData,InheritanceLevel,PropagationFlags., AccessControlType.Allow));
Directory.SetAccessControl(_dbPath, dirSec);
|
|
|
|
|
try this:
dirSec.AddAccessRule(new FileSystemAccessRule(IdentityReference, FileSystemRights.WriteData,
InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow));
Edit: Splitted message, because it isn't rendered correctly
modified on Saturday, November 28, 2009 5:23 AM
|
|
|
|
|
Hi
I used reflection many times before on public methods but never realized that private methods can be invoked too. See the link : link
I am still thinking why is that allowed in the first place?
Isn't that going to break the rule of "private" being "private"?
puzzled
AJ
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|