|
Dear Rossi,
Using your pop filter then datagridview color changed. I want to filter without change color.plz help to do the above request
|
|
|
|
|
It looks as though you are asking a question about a piece of code in an article. At the end of the article is a forum for you to ask questions. That's where you should ask your questions, not here. The chances of the author just happening by and seeing the question are very slim.
|
|
|
|
|
Don't post this here - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi as i am a beginner i am currently doing a project alone in c# and it describes that
1) To retrieve the senders name, mail address,subject and body of an unread email in outlook.
2) To add a buttons in a context menu that when we right click on a unread email we need to get a button called `spam` and `not spam` and we should write a javascript code when we click on that spam button it the mail should move to spambox. please can anyone help me out in getting this?
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The first part to retrieve the senders name, mailid and body of the message i tried using the following code
Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder myContacts = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderContacts);
mapiNameSpace.Logon(null, null, false, false);
mapiNameSpace.Logon("YourOutlookMailID", "Password", Missing.Value, true);
Microsoft.Office.Interop.Outlook.Items myItems = myContacts.Items;
Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
Microsoft.Office.Interop.Outlook.Items inboxItems = myInbox.Items;
Microsoft.Office.Interop.Outlook.Explorer myexp = myInbox.GetExplorer(false);
mapiNameSpace.Logon("Profile", Missing.Value, false, true);
if (myInbox.Items.Count > 0)
{
Console.WriteLine(string.Format("Total Unread message {0}:", inboxItems.Count));
int x=0;
foreach (Microsoft.Office.Interop.Outlook.MailItem item in inboxItems)
{
Console.WriteLine("{0} unread mail from your inbox", ++x);
Console.WriteLine(string.Format("from:- {0}", item.SenderName));
Console.WriteLine(string.Format("To:- {0}", item.ReceivedByName));
Console.WriteLine(string.Format("Subject:- {0}", item.Subject));
Console.WriteLine(string.Format("Message:- {0}", item.Body));
System.Threading.Thread.Sleep(1000);
}
Console.ReadKey();
}
[edit]Code block added - OriginalGriff[/edit]
modified 25-Feb-20 4:15am.
|
|
|
|
|
And?
Does it work? How did you test it? What results did you get?
What have you tried?
Where are you stuck?
What help do you need?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ya it worked fine at some part as when we test it in VSTO it redirects and opens outlook. But i am not finding any output as it is supposed to display the retrieved data when we test.
|
|
|
|
|
So what have you done to find out why? What does the debugger show?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I need help to fix an issue where when data from web application is exported to Excel by clicking a button export to excel, if the data in a cell contains double quotes, that data should be displayed without the double quotes visible.
Previously I made a change to the application code in VB so that the output exports text fields with formulas (="") to force Excel to treat those values as a string. This has been working except some instances where the output actually displays the formula characters (="") within the cell as text, rather than as hidden formulas. It appears when a cell contains text with an actual double quotes that is when after export to Excel is done, those quotes appear in Excel. I need help to figure out if there is a way to suppress those.
For example. A cell with the following data Allows the user the abilities to Add, View, Modify and Delete Notes on the Notes Tab of the Case Record. "View" allows the user to view the Notes Tab of the Case Record.
When this is exported to Excel the data is displayed as follows ="Allows the user the abilities to Add, View, Modify and Delete Notes on the Notes Tab of the Case Record. "View" allows the user to view the Notes Tab of the Case Record. I do not want to quotes to appear in Excel.
On the other hand, a cell with the following data Maintain Victim Classification Types. when this is exported to Excel there are no visible quotes. It displays as Maintain Victim Classification Types.
Here is my VB code that needed changing
Dim row As DataRow
For Each row In dt.Rows
sw.Write(vbNewLine)
Dim column As New DataColumn()
For Each column In dt.Columns
If Not row(column.ColumnName) Is Nothing Then
sw.Write("=""" & row(column).ToString().Trim() & """" & vbTab)
Else
sw.Write(String.Empty + vbTab)
End If
Next column
Next row
modified 24-Feb-20 14:44pm.
|
|
|
|
|
NB: You've posted this in the C# forum. It should really be in the VB.NET forum, since you're using VB.NET code.
You're exporting to a "tab-separated variables" file. You will have very limited control over formatting for this type of file.
It would probably be better to export to a "real" Excel file instead. For example, using EPPlus[^]:
Using package As New ExcelPackage()
Dim sheet As ExcelWorksheet = package.Workbook.Worksheets.Add("Sheet1")
sheet.Cells("A1").LoadFromDataTable(dt, True, TableStyles.Medium9)
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
package.SaveAs(Response.OutputStream)
End Using EPPlus will give you a lot more control over the resulting file:
Getting Started · JanKallman/EPPlus Wiki · GitHub[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I think what you are asking is how to have double quotes inside a string that is being converted into a quoted string. If so, not only do you need to add double quotes at both ends (which you already do), but you ned to double the embedded double quotes, viz:
sw.Write("=""" & Replace(row(column).ToString().Trim(), """", """""") & """" & vbTab)
(It looks yucky because the double quotes have to also be doubled in the 'from' and 'to' arguments in the Replace() function)
|
|
|
|
|
HOW I CAN GET C# WINDOW FORM THEME?
PLEASE HELP ME THIS QUESTION.
THANK YOU.
|
|
|
|
|
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
And then explain what you mean: we have no idea what you understand by "WINDOW FORM THEME" so we can;t help you until you explain.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have an ICollectionView bound to a DataGrid which contains 1 million items and should be filtered as user types in a search text box. Due to the large number of items, filtering algorithm should be performance friendly.
This is my current string comparison (some part of filtering method):
static bool AreEqual(string str1, string str2)
{
var compareInfo = CultureInfo.InvariantCulture.CompareInfo;
bool result = compareInfo.IndexOf(str1, str2, CompareOptions.IgnoreNonSpace) > -1;
return result;
}
The CompareOptions.IgnoreNonSpace ignore diacritics very well but ignores half space with Unicode \u200c too, which is not what I want. I just want to ignore diacritics.
bool compare1 = AreEqual("آبی","آبی");
bool compare2 = AreEqual("آبی", "ابی");
bool compare3 = AreEqual("آبی", "آبی");
bool compare4 = AreEqual("آبی", "ابی");
Since, the performance is critical, I can't remove diacritics with normalizing strings before comparison.
One more question:
I want to filter CollectionView, in a way that, first 10 results will be returned and continue to search in a background thread while user is reading current DataGrid viewport. When user scrolls the DataGrid, show next 10 results which are filtered in the background thread. I don't want user waits for CollectionView to finish filtering 1 million items.
|
|
|
|
|
You can start a search background worker that adds results to a concurrent queue.
The UI threads pulls results from the queue and displays them. Keep the results and reuse them when doing incremental searching.
If you're buffering x results at a time, stripping diacritics, etc. is not a performance issue.
A "million" something doesn't say much. If it fits in memory, loading it in the first place is the main issue, and can be done while the app is starting up.
Then consider replacing all your int enums with byte or flag enums in the data, etc.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
My database is a text file contains 1 million string line, like this:
word1,word2,word3,word4
word1,word5,word7,word4,word6
word3,word4
word5,word6,word7
Loading the file into a CollectionView doesn't take many time (About 1 second). The main issue is Filtering collection view, because datagrid uses a little complex data template. Can you give me a sample code to showing just 10 result at a time?
This is my code
|
|
|
|
|
private int paged = 0;
...
var items = myList.Skip( paged ).Take( 10 );
paged += items.count;
...
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi,
I want to make a query to an xml database.
I use a textbox to ask the query but i cant get it work
Here is the code that i have
XDocument doc = XDocument.Load(@"C:\Work\stores.xml");
var xpath = "//store/Color[text()]" + textBox2.Text;
var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<XElement>().FirstOrDefault();
textBox1.Text = result.Value;
xml:
<pre><stores>
<store rollNumer="170">
<Name>Jonh</Name>
<Color>Pink</Color>
<Sell>Sugar</Sell>
</store>
<store rollNumer="120">
<Name>Tedy</Name>
<Color>Brown</Color>
<Sell>Rice</Sell>
</store>
</stores>
Thank you
|
|
|
|
|
devilonline1 wrote: i cant get it work
Means nothing to us: we can't run your code under the same conditions you do (if nothing else my file structure will not contain the same paths as yours) so we need much better information.
"It doesn't work" is probably the most useless problem report we get - and we get it a lot. It tells us nothing about what is happening, or when it happens.
So tell us what it is doing that you didn't expect, or not doing that you did.
Tell us what you did to get it to happen.
Tell us any error messages.
Tell us what you tried to work out what is happening.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
well I have this code:
XDocument doc = XDocument.Load(@"C:\Work\stores.xml");
var xpath = "//store/Color[text()=]" + X;
var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<XElement>().FirstOrDefault();
textBox1.Text = result.Value;
and it worked fine
when I want to pass a variable it gives the error: " System.Xml.XPath.XPathException: the expression must be aviliated.." in this line "var result = ((IEnumerable)doc.XPathEvaluate(xpath)).Cast<xelement>().FirstOrDefault();"
|
|
|
|
|
devilonline1 wrote: the expression must be aviliated
That's not the correct error message. Did you mean:
"Expression must evaluate to a node-set"
That still means that your XPath query is invalid.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I'm not sure if this will help you, but I know how you feel regarding querying XML... It has plagued me for about a week now. I just came up with this code yesterday, it searches, copies and saves XML:
private static object GetSetting(string source, string setting)
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(source);
return xdoc.SelectSingleNode("/Settings/" + setting).InnerText;
}
private static void AdjustSetting(string source, string setting, string value)
{
XmlDocument xdoc = new XmlDocument();
xdoc.Load(source);
xdoc.SelectSingleNode("/Settings/" + setting).InnerText = value);
xdoc.Save(source);
}
And here is the XML:
="1.0"="utf-8"
<Settings>
<Exit>true</Exit>
</Settings>
finally, here is the code I'm using this on:
AdjustSetting(Xmlpath, "Exit", "false");
while (GetSetting(XmlPath, "Exit").ToString() != "true")
{
ProcessInput(Console.ReadLine());
}
If you need me to explain any of this please feel free to ask. I hope it helps..
|
|
|
|
|
i am getting below error
System.Web.Services.Protocols.SoapException: Format of the initialization string does not conform to specification starting at index 97.
below is my connection string
<property name="connection.connection_string">"Provider=SSISOLEDB.3;Data Source=***;User ID=***;DB=**;PWD=**;"
i am using nhibernet
|
|
|
|