2 Replies - 305 Views - Last Post: 02 December 2013 - 07:48 PM Rate Topic: -----

#1 Hiimnate  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-December 13

Altering text case within the clipboard

Posted 02 December 2013 - 05:16 PM

Hello,
At my place of work I am being asked to change fields in a database from uppercase to capital case. I figured using a macro would be the fastest way to accomplish this task. The macro I'm using involves a few basic steps but one of those steps is to convert what I have on the clipboard from uppercase to capital case. I've used a couple other programming languages but never C#, can someone help me figure out where im going wrong?
Also I apologize for the unnecessary amount of references in my code but I was trying everything I could think of.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.IO;

class Program
{
    String changecase = null;
    String capital = null;

    public String Clipboardchange(String changecase)
    {
        if (Clipboard.ContainsText())
        {
            changecase = Clipboard.GetText();
            changecase = CultureInfo.CurrentCulture.TextInfo.ToLower(changecase);
            capital = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(changecase);
            Clipboard.SetText(capital);
        }
        return capital;
    }

    static void Main()
    {
    }
}



Is This A Good Question/Topic? 0
  • +

Replies To: Altering text case within the clipboard

#2 astonecipher  Icon User is offline

  • D.I.C.
  • member icon

Reputation: 795
  • View blog
  • Posts: 3,484
  • Joined: 03-December 12

Re: Altering text case within the clipboard

Posted 02 December 2013 - 05:23 PM

What is this in? I am not really following. You need to change fields in a database, so you need a function to UPDATE the field from THIS to This? Where does the clipboard come in? and right now your program does nothing, because there is nothing in your main.
Was This Post Helpful? 0
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: Altering text case within the clipboard

Posted 02 December 2013 - 07:48 PM

Quote

can someone help me figure out where im going wrong?


Well... astonecipher summed it up well.

Where you have gone wrong:
Your original concept to do this through the clipboard instead of on the database itself.
Then again, we are assuming you really mean a database (as in SQL) where you can give it commands to read/write the data. If you aren't doing this on some kind of real database then its anyone's guess.

Let's just say for a moment that you CAN'T really communicate with your database the way you should. You still don't want to be going the some pidly field-by-field macro to do this. Are you going to have an operator go to a form, field 1 copy, then run the macro, the paste the new value, {repeat for 100 fields}, {repeat for 1,000 records}

At the very least you should screen-scrape the form for the data and have it go through all the fields it can find on the screen.

It really seems like you're approaching this from a 1980's perspective. How about some more information on the program and the KIND of database this is working from. Also some detail on your coding experience would help us try to tailor suggestions to your skillset.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1