|
Nope. Managed code, C#, VB.NET, or any other language that targets the .NET CLR, cannot be injected into other processes, and you cannot inject code into the kernel.
|
|
|
|
|
hi i am a newbie to .net.
while developing an application for the PTZ camera i faced the follwing problem.
please help me.
((System.ComponentModel.ISupportInitialize)(this.axMSComm1)).EndInit();
"Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Check the ErrorCode property of the exception to determine the HRESULT returned by the COM object"
please give me instructions so that i am able to fix this error
|
|
|
|
|
Hi there,
I'm going to have a quite large excel document on Books.
This will include for example a name, idnumber, author etc.
In my program in Visual Studio I have a class for each of these books that also contains a string for the name, int for the idnumber, etc etc.
Is there anyway to easily import this data and auto create the class code without having to manually put it in?
Thanks
|
|
|
|
|
Hi,
do you want to import the data of the excel book? What you could do is to export the excel file to csv, then read this file line by line and create an object of your book class by setting the fields according to the values.
Regards
Sebastian
|
|
|
|
|
Thanks for the idea!
You're a legend! =}
|
|
|
|
|
Dear friends,
i have small clarification ..
i have list box, while selecting any item, blue color will the back gourd appears for the selected item , i do not want that blue color
how to remove that???
sorry i do not have bled.. so some one can give the solution as xaml
Thank you
By
Joe
|
|
|
|
|
Dear fiends,
i got the answer ..
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
Thank you
|
|
|
|
|
Hi,
Im trying to find out the simplest way to store variable values in a file (text or otherwise), as well as being able to read specific areas of the file in order to retrive the values and implement them into a windows form control like a textbox or something. The StreamReader and StreamWriter class works but I dont know how to read specific lines like line number 4 or so. Here is my code:
<pre>
StreamReader sr = new StreamReader("configFile.txt", System.Text.Encoding.Default);
string s = null;
while ((s = sr.ReadLine()) != null)
{
if (s.IndexOf("Name:") != -1)
{
// textBox1.text = s;
break;
}
}
sr.Close();
</pre>
The issue is that I cant select what to search for by line number. All i need is a simple way to add textbox values to a text file where each texbox has its own line in the text file, and I can call up the text file at a certain line of the file and read the contents/make it the textbox text. The data is numerical. I came across hash tables but I do not know how to implement them/save them to a file.
|
|
|
|
|
One approach is to use a xml file.
Lots of examples on the web of how to do this.
Try looking at this[^]
|
|
|
|
|
Awesome advice! Thnks! Here is a website for anyone who is curious as to how to work with XML from the gorund up. Very comprehensive tutorials.
http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmltutmellli21.aspx
|
|
|
|
|
the simplest solution probably goes like so:
- keep key,value pairs in the file, one per line, all keys unique, key and value separated by some symbol (= seems the obvious choice);
- read all lines with File.ReadAllLines
- inside a foreach loop, split the line using string.Split('=',2), use the first part as a key, the second as a value, and stuff that into a Dictionary
Done. Less than 10 lines of code.
|
|
|
|
|
Possibly dumb question but how do I use the key you stated? I know its an identifier for the value string but do i just use my code to search for it? Like <code> if (s.IndexOf("fn:") != -1) </code> ? or what?
|
|
|
|
|
You create the dictionary like so (omitting error handling):
Dictionary<string, string> dict=new Dictionary<string, string>();
foreach(string s in File.ReadAllLines(path)) {
string parts[]=string.Split('=', 2);
dict.Remove(parts[0]);
dict.Add(parts[0], parts[1]);
}
You look up a key's value by using the key as an index to your dictionary, like so:
string name=dict["Name"];
You enumerate all key-values (maybe not in original order!) like so:
foreach (KeyValuePair<string, string> kvp in dict) {
log(kvp.Key+"="+kvp.Value);
}
You could also prepopulate the dictionary with default values for some keys:
dict.Add("Name", "Jef");
dict.Add("Occupation", "Software Engineer");
|
|
|
|
|
|
Is the file physically saved anywhere in order for me to acess it later? if so, how do I bring up a dictionary object from a file?
|
|
|
|
|
Hi,
you could save settings to disk by creating a loop, similar to the foreach I have shown; and later reload just like you load the first time.
PS: replying to yourself, I did not get a notification and saw your message only by accident.
|
|
|
|
|
I am testing out using Exchange Webservices to post tasks to the current user in a corporate intranet.
The code below works when I run it through Visual Studio 2008 debug mode, but when I publish it to the intranet site, it bails with the following error:
Microsoft.Exchange.WebServices.Data.ServiceResponseException:
When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.
I have disabled anonymous access to the website and have it set security to Integrated Windows Authentication.
As you can see below, I am passing the default credentials to the web service.
What am I missing here?
Any help will be appreciated.
public class ExchangeTask
{
ExchangeService myService = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
public ExchangeTask()
{
ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
};
myService.UseDefaultCredentials = true;
myService.AutodiscoverUrl(EmailAddressToFind);
ServiceURL = myService.Url.ToString();
}
public void SendTask()
{
Task myTask = new Task(myService);
myTask.Body = "This is a reminder task that has automatically been set by ExchangeWebservices";
myTask.DueDate = DateTime.Now;
myTask.ReminderDueBy = DateTime.Now;
myTask.StartDate = DateTime.Now;
myTask.Subject = "Event Reminder Task";
myTask.Save();
}
|
|
|
|
|
Just in case anyone ever looks at this question again,
The solution was to put <identity impersonate="true" /> in the web.config file under <system.web>
|
|
|
|
|
I'm having same problem.
You can try adding: <identity impersonate="true"> in the web config.
If I hardcode a user, password, and domain it works fine, but trying to get cached credentials seems hopeless.
|
|
|
|
|
I have the following xml:
<Resume>
<Details>
</Details>
<Contacts>
</Contacts>
</Resume>
how can I add childs to the Contacts using C# but with referring to the <Contacts> by name not by ID?
I want to add:
<Contacts>
<Contact ID="xxxxxxxx">
<Category>my category</Category>
<Number>my contact number</Number>
</Contact>
</Contacts>
|
|
|
|
|
|
You can use c# DOM to access the XML or DHMTL.
Try this:
http://progzoo.net/wiki/C%23:Navigating_over_DOM_Tutorial
modified 27-May-14 4:40am.
|
|
|
|
|
As I already said, look to XPath.
If you load your XML into an XmlDocument, you can get the desired contact by doing:
xmlDoc.SelectSingleNode("/Contacts/Contact[@ID='xxxxxxxxx']");
Then, you have a reference to the node into which you can add subnodes.
|
|
|
|
|
Hi,
I am fairly new to programming and I am making member registration apllication.
The main form contains a DataGridView with all the checked in members. The DataGridView connects to a
stored procedure. This main form is also the start-up form.
In the search results form I can check in / out a member. This done by clicking a button that calls a stored procedure.
Now for my question:
After I click the checkin / out button I want to update the DataGridView in the main form.
I don't seem to be able to make this work.
Below is the code that I use.
The following method is placed on the main form. This is the method I want to call from the other form.
public void FillDataGrid()
{
this.aLL_CHECKED_IN_MEMBERTableAdapter.Fill(this.on_target_v1DataSet.ALL_CHECKED_IN_MEMBER);
}
I want to call this method through the following code, this code is located on a different form:
public void btnCheckIn_Click(object sender, EventArgs e)
{
Procedures.CallStoredProcedure.CHECK_IN_MEMBER(this.lblNumber.Text);
CheckInOut(this.lblNumber.Text);
frmMain cls = new frmMain();
cls.FillDataGrid();
}
Does anyboady have any ideas how I can tackle this?
Regards,
Paul Stol
|
|
|
|
|