|
hehe, thanks, but very vague, that was the method I was trying but redrawing part of the first bitmap was what i didnt know how to do.
here is example of working code:
<br />
Bitmap newone = new Bitmap(100,100);<br />
Graphics g4 = Graphics.FromImage(newone);<br />
System.Drawing.Rectangle dstRect = new System.Drawing.Rectangle(0, 0 ,100, 100);<br />
g4.DrawImage(screenGrab, dstRect, 30,40,100,100,System.Drawing.GraphicsUnit.Pixel);<br />
newone.Save("C:/thenewone.bmp");<br />
screenGrab is original bitmap, its uncommented, but if anyone needs it u can work it out.
|
|
|
|
|
Hello All,
I have a problem while altering DBF table in C#.NET
I have downloaded foxpro driver and working with OLEDB but when running the following code snippet , the format of DBF table gets corrupted
**************code Snippet*************
public void Alter_table()
{
try
{
string strConnect;
strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source='d:\';Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Exclusive;Extended Properties=;Encrypt Password=False";
OleDbConnection dconn=new OleDbConnection();
dconn.ConnectionString = strConnect;
dconn.Open();
OleDbCommand mycmd=new OleDbCommand();
OleDbCommand myCmd = new OleDbCommand("ALTER TABLE 22.dbf ADD COLUMN TEST1 c(10) NULL", dconn);
myCmd.ExecuteNonQuery();
}
catch(OleDbException ex)
{
MessageBox.Show(ex.Message);
}
}
Please help me its quite urgent,Any sort of help is welcomed
Thanks & Regards
Anil Dhiman
Anil Dhiman
GIS Engineer
|
|
|
|
|
I have confirmed that Zone Alarm "phones home" as has been recently written about on the internet. I have confirmed that this "bug" has been occurring since early 2004 when version 4.5 of the product was released.
Trying out other software firewalls, i find that many applications on my computer "phone home" including Firefox, MS File Explorer (not IE), Linksys software drivers, and more.
I will use a firewall to watch these programs. Because of my experience with "phone home" Zone Alarm i need something that will "watch" the firewall to make sure it does not do anything nefarious such as "phone home".
Is there a straightforward way to monitor a program to see if and when it tries to connect to the internet? So far i have not found anything in C# or C, C++. Anyone out there with network programming eperience who can point me in the right direction?
If i succeed in making this little utility i will share it with the Code Project.
|
|
|
|
|
This is NOT be a little utility. What' you'd be writing is your own firewall! There is nothing straightforward about this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok. I thought maybe there might be some Win32 api function or something in the NET framework that might be able to do something basic like make a global hook, then filter windows messages until on sees IP activity or similar. If it is a black art i will abandon the idea in favor of periodically running a second firewall to watch the primary one.
|
|
|
|
|
redfish34 wrote: in favor of periodically running a second firewall to watch the primary one
You don't want to do that. You'll cause yourself more headaches than it's worth. I've had too many people call me up and tell me "I can't get to the Internet anymore". My first question is always "What's did you do?" The usually answer is "Nothing!", but then I find out they installed a second firewall, or a third, without uninstalling the first one.
Yes, app's can phone home. It's not really that big of a deal. Most of them are not sending any nasty information about you, but are checking for updates. It seems the popular thing to do now that Windows does it.
If you want to see what they're doing, install a packet sniffer. Microsoft has Network Monitor...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK. First what you'd want to look into is the code on the application detecting when user logs on to the internet. Unfortunitly I don't have that much knowlage so far.
Your onto something great if you could get it going.
I had an idea for this sort of thing once but cannot do it. The application I wanted to create would:
If a virus was being downloaded it would follow the virus and give the the IP address of the computer that it came from. That be a good extra if it could be done.
In the end we're all just the same
|
|
|
|
|
In C# ListView Control.
We use shift or ctrl key to add or remove multiple items from listview.
Is there any programable way to add or remove selected items or indices from ListView? Like I can manually add/remove items from SelectedItems collection or add/remove index from SelectedIndices.
Thanks
Tengpo
|
|
|
|
|
You can iterate thru the Selected ListViewItem Collection and add/ remove items
Here is the code to remove the selected items.
foreach(ListViewItem li in lstViewResultSet.SelectedItems)
{
li.Remove();
}
hope this will help you.
Gokul
|
|
|
|
|
I know this is a really stupid question, but why am I getting the above error at the line
in my codebehind when I set the Label1.Text variable? I set runat to server in my code
page and I've declared the control in my codebehind. I would think that the variable
would be accessible anywhere in the codebehind page.
Thanks.
// Codepage:
<asp:label runat="server" id="Label1">// Codebehind:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Repeater Repeater1;
private void Page_Load(object sender, System.EventArgs e)
{
string connString = "Data Source=(local);Initial Catalog=MyTable;User ID=MyUID; Password=MyPwd;";
string sqlString = "SELECT Column1, Column2 FROM SomeTable";
try
{
using (SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(sqlString, conn))
{
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read())
{
Repeater1.DataSource = rdr;
Repeater1.DataBind();
}
}
}
}
catch
{
Label1.Text = "Error!"; // <- Object reference error occurs here
}
}
}
|
|
|
|
|
the same code is working fine for me ..
but it would be good if u mention the line where it catches the error
sathy
|
|
|
|
|
imsathy wrote: it would be good if u mention the line where it catches the error
I did. Didn't you see the line with the comment?
// <- Object reference error occurs here
|
|
|
|
|
RobertF57 wrote: did. Didn't you see the line with the comment?
// <- Object reference error occurs here
the code execution comes in to catch block after the error occurs ...
what im asking u is at which point it catches the error
keep a break point in ur code and c where the try block catches error
sathy
|
|
|
|
|
You probably missed something in the label. What does the code for the label look like?
---
b { font-weight: normal; }
|
|
|
|
|
Does anyone have an example of how to persist the values from an enum into a
Checked Listbox in the Visual Studio property Grid? There is an excellent example on this site by Thierry Bouquain (http://www.codeproject.com/cs/miscctrl/flagseditor.asp) but it uses code in the client page to persist the values Checked Listbox/ Enum values. I want mine to work more like third party components I have seen wqith no code in the client form required to persist the values. I have looked around and I think I need to use a TypeConverter to convert the selections to a pipe delimited string and stored in the designer. Getting the typeconverter to work has been complicated as I do not have a lot of experience with CodeDom / Reflection.
|
|
|
|
|
I am having a weird problem adding new objects to the directory server. I am logged in using the Manager account, so I have r/w access to everything. Here's how I add an object:
DirectoryEntry de = configuration.Bind(); // <- this works fine, I can read everything.
DirectoryEntry newEntry = de.Children.Add("cn=John Doe", "inetOrgPerson");
newEntry.Properties["sn"].Value = "Doe";
newEntry.Properties["givenName"].Value = "John";
newEntry.CommitChanges(); // <- this is where the exception is thrown.
System.Runtime.InteropServices.COMException (0x80072037): There is a naming violation.
at System.DirectoryServices.Interop.IAds.SetInfo()
at System.DirectoryServices.DirectoryEntry.CommitChanges()
at HMSImport.MainForm.menuItem3_Click(Object sender, EventArgs e) in c:\documents and settings\jd\my documents\visual studio projects\hmsimport\mainform.cs:line 255
Does anyone have a clue as what it could be?
I am running openldap-2.2.9 as the directory server.
|
|
|
|
|
Hi Jan,
I dont think you should do like this:
newEntry.Properties["sn"].Value = "Doe";
newEntry.Properties["givenName"].Value = "John";
rather use Add instead of Value this it should work
newEntry.Properties["sn"].Add = "Doe";
newEntry.Properties["givenName"].Add = "John";
I hope it helps
Osama Mirza
|
|
|
|
|
I am trying to achieve the following:
I start with two class library projects, e.g. phlib/phtree/phtree.sln and phlib/phmatrix/phmatrix.sln. Both have sub projects with examples, Q&D tests and unit tests.
I want to create a "main" class library project (phlib/phlib.sln), that references the relevant sources from the sub folders (but excludes the helper projects code)
is that even possible? C# (at least C# express) seems to always include all files. When I do "Add existing item", the file gets copied into the phlib project folder.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
Private Sub Socket_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Socket.DataArrival
I have this already put into my Constructor
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
socket.dataarrival += new EventHandler(Socket_DataArrival);
Do i need to use the AxMSWinsockLib ?? because i'm not sure what goes in the Code Below here
private void socket.dataarrival(object sender, // Dont know what is suppose to be in this part)
Thxs in Advance..
-- modified at 17:55 Thursday 2nd February, 2006
|
|
|
|
|
I want to create a virtual serial port from my program, so I can send out serial data. I want my program to simulate an actual physical device, such as a GPS or Gyro, for testing purposes. I have seen many comercial programs that create two virual ports, and connect them, but I want just my program to expose itself as a serial port.
Ross King
------------------------
"Beer. Not just for breakfast anymore"
|
|
|
|
|
|
|
I'm currently having a problem, i hope one (or more) of you can help me out.
I have an application that loads DLL's from a directory in a seperate AppDomain. After that it gets the functions i want out of it using the System.Delegate class. So far so good. The functions are proparly loaded etc etc.
The thing is, i can only call the functions from within that particular AppDomain. At least thats what i think the problem is. But i do not want that. I want to be able to define the functions that i need from outside the wrapper that loads the dll's. I can say which functions it needs to pass to me but i cant attach a delegate to it in order to invoke the function.
Since i think the story above might be a bit confusing i'll set up an example.
Example:
<br />
delegate int Foo ();<br />
delegate void Bar (int Foobar);<br />
<br />
dllWrapper Wrapper;<br />
<br />
Wrapper.INeed("Foo_Inside_DLL", typeof(Foo));<br />
Wrapper.INeed("Bar_Inside_DLL", typeof(Bar));<br />
<br />
FunctionList myFunctions = Wrapper.LoadAll("plugins\\");<br />
<br />
<br />
Function FooFuntion = myFunctions.Find("Foo_Inside_DLL");<br />
<br />
((Foo)FooFunction.Delegate)();<br />
<br />
<br />
|
|
|
|
|
|
ahhh, never knew it would be that simple!
thanks, you're a life saver!
Edit (for those who want to know):
when you have functions in a seperate AppDomain you can _not_ call them from any other domain directly. What you can do is create a method in the class that contains the function that does a DynamicInvoke()
so in my case it was as simple as this:
<br />
FooFunction.Invoke(null);<br />
<br />
public object Invoke (params object[] args)<br />
{<br />
this.Delegate.DynamicInvoke(args);<br />
}<br />
and thats it, it works brilliantly!
-- modified at 18:14 Thursday 2nd February, 2006
|
|
|
|