1,076,453 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by thines01 which have been Voted Up

If Cell C1 contains the formula =VLOOKUP($A3,$B$1:$B$6,1,FALSE)
then the result in Cell C1 will be "#N/A"
You can then choose to filter on the "#N/A" values or you can use IsError() to convert them to user-friendly values:
=IF(ISERROR(VLOOKUP($A1,$B$1:$B$6,1,FALSE)), $A1, "")
...
=IF(ISERROR(VLOOKUP($A2,$B$1:$B$6,1,FALSE)), $A2, "")
...

Which means: if the result is not found, show the value of the original cell, otherwise show blank.
When the formula is pasted all the way down for each value, the result will be a,c,e,f

Attachments DW_451359.jpg 10.54KB
thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

If you can wrapper the DLL in an MFC enabled app, you can then flip the /clr switch.
THEN you can call the methods from any dot net app.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

When you say "save a file", do you mean a file that has been uploaded to the web page?
Are you using a file upload control?
If so, you call SaveAs() to store the uploaded file in a particular location,

FileUpload fu = new FileUpload();
//...

fu.SaveAs(strTempFileName);
thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Your code is calling ExecuteReader. That's not what you're trying to do ("reader").

You need ExecuteNonQuery()

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Also the class is actually so that I can make custom types

That has already been taken care of with Template/Generic classes.

Be careful not to drag old-school baggage with you as you learn CLI.
After C++ and MFC, I learned C#, THEN CLI.
I had originally tried CLI, but it seemed confusing (until I learned C#).
There are lots of things you no longer need to write (with CLI).

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Put the numbers into one string.
Use a substring to determine the offset and the length of what you're printing.
Loop 4 times.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Are you talking about the Windows System Registry?
If so, all you will need to do is have your programs use the already existing classes and methods to manipulate it.

http://www.developerfusion.com/article/4640/registry-ins-and-outs-using-c/2/
http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.aspx

Also, does this need to be WCF if the communication between the programs is to be through the registry?

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

How about this?:

#include "stdafx.h"
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Linq;
using namespace System::Text::RegularExpressions;

bool wildcmp(String^ input, String^ pattern)
{
   String^ strNewPattern =
      "^" + 
      pattern->Replace(".", "\\.")
      ->Replace("*", "\\b\\w*\\b")
      ->Replace("#", "(\\w*)*.*")
      + "$";
   return Regex::IsMatch(input, strNewPattern);
}

int main(array<System::String ^> ^args)
{
   String^ strPattern = "usa.#";

   List<String^>^ lst_strInputs =
      Enumerable::ToList<String^>(
         gcnew array<String^>{"usa.weather.usa", "usa.weather"});

   for each(String^ strInput in lst_strInputs)
   {
      Console::WriteLine(wildcmp(strInput, strPattern) ? "Matched" : "Did not match");
   }

   return 0;
}

I noticed a flaw in the first example, but have not fully tested this one.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

I understand that.
What I'm trying to understand is how ONE word is not the same as ZERO-or-MORE words.

THEN I need to see:
1) a literal string that passes the ONE word test.
2) a literal string that passes the ZERO-or-MORE words test.
3) a literal string that fails the ONE word test.
4) a literal string that fails the ZERO-or-MORE words test. <<PROBLEM

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

The technique I used is replacing the hash-mark and the asterisk with "Regular Expressions".
In the dot net world, we have the Regex class that is built just such a thing.
You can have a Regex that matches almost any type of pattern as long as you can express it correctly.

The System::Text::RegularExpressions; namespace holds the functions that do the Regex.

I am simply replacing your pattern characters (hash and star) with Regular Expressions that should find what you expect.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

All you need to do then is manipulate which regular expression best fits your definition of the hash and the star in the example I gave.
What's confusing ME is the definition of one WORD versus ZERO or MORE WORDS.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

First set of requirements:

Here # represnts one word while * is for one alphabet
*

Second set of requirements:

*(star) can substitute for exactly one word.
# (hash) can substitute for zero or more words.
*

If you swap the hash and the star in my example, it will work based on your first set of requirements.

If you want to use the second set of requirements, how will you recognize one character? ...as a word?

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Maybe you could store the articles as files, but keep track of their location, date, title and other searchable items in the database. ...but that depends on how the articles are to be searched and how long you will keep them.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

Since you seem to be using C++/CLI (along with STL), I'm going to assume CLI is acceptable.
The following example replaces your special characters with Regular Expression syntax.
You can tweak the Replace parameters to be exactly what you want, but you can see what was done here:

#include "stdafx.h"
using namespace System;
using namespace System::Text::RegularExpressions;

bool wildcmp(String^ input, String^ pattern)
{
   String^ strNewPattern = pattern->Replace("#", "\\w+")->Replace("*", ".");
   return Regex::IsMatch(input, strNewPattern);
}

int main(array<System::String ^> ^args)
{
   String^ strPattern = "usa.#.*";
   String^ strInput = "usa.weather.u";

   if (wildcmp(strInput, strPattern))
   {
      Console::WriteLine("Matched");
   }
   else
   {
      Console::WriteLine("Did not match");
   }

   return 0;
}
thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

You'd be better off putting the chars into a jagged array and just retrieving the whole (inner) array based on the offset of the digit pressed.

  private static char[][] arr_arr_chrPhonePad = new char[10][]
  {  // jagged array
     new char[]{}, //0
     new char[]{}, //1
     new char[]{'a', 'b', 'c'}, //2
     new char[]{'d', 'e', 'f'}, //3
     new char[]{'g', 'h', 'i'}, //4
     new char[]{'j', 'k', 'l'}, //5
     new char[]{'m', 'n', 'o'}, //6
     new char[]{'p', 'q', 'r', 's'}, //7
     new char[]{'t', 'u', 'v'}, //8
     new char[]{'w', 'x', 'y', 'z'}, //9
  };

So

 arr_arr_chrPressed[3]

will return 'd','e','f'.

And

 new String(arr_arr_chrPhonePad[3])

will make a string "def"

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

The problem comes from Carriage-Returns inside the cells of the DataGridView, right?
If you chek the content of each cell (or target cells) for unwanted chars, you can replace them before writing them to the CSV.

Like:
...Value.ToString().Replace(Char(13), " ").Replace(Char(10), " ").Replace(Char(9), " ")

There are other ways, also.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

The System.Xml.Linq namespace is the easiest to use (in my opinion).
What changes are you expecting to make in different locales/countries?

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7

In Solution Explorer, right click the solution name and select:
Add -> Existing Project

Browse to your existing project and add it.
Remember to add the reference from the sub-project to the main project.
...do it in the "project" tab under the Add References dialog box.

thines01
Postaholic
Team Colleague
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
 
© 2013 DaniWeb® LLC
Page rendered in 0.1670 seconds using 2.75MB