Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

TabascoSauce

@TabascoSauce
About
Posts
20
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Remove whitespace in front of String element of an Array (vba, excel macro)
    T TabascoSauce

    I created a macro that gets a list of elements (strings), puts them into an array, then creates an appropriate number of worksheets each named after an element in the array. Everything works fine. However, occationally when dealing with this list of elements, they are arranged in a sort of list-sublist-evenmoresublist pattern, meaning that there is some variable number of whitespace in front of some of the elements. I know this is fairly simple, I am not entirely new to the programming world, but I am new to vba in Excel and from prior experiences working with macros, there is a ton of built in functions that I am unaware of and they makes tasks like these pretty simple. (excuse the run-on :-D ) Here is the block that handles my count elements/load into array (feel free to correct it if there is a simpler route):

    'Count Elements, dimension element array to appropriate size
    n = 7
    eCount = 0
    Do While Worksheets("Costs Incurred").Cells(n, 2) <> ""
    If Worksheets("Costs Incurred").Cells(n, 2) <> "" Then
    eCount = eCount + 1
    End If
    n = n + 1
    Loop
    ReDim elements(1 To eCount)

    'Load Element names into Element Array
    n = 1
    Do While n <= eCount
    elements(n) = Worksheets("Costs Incurred").Cells(n + 6, 2)
    n = n + 1
    Loop

    Thanks for any help!

    Visual Basic data-structures regex help

  • Determining if an inputted file name exists?
    T TabascoSauce

    Aha I see the logic in this now. It's funny how something so fundamentally obvious can completely escape my thought process haha. Anyway, thank you very much :D It appears to work now :D:D

    Managed C++/CLI help question csharp c++ tutorial

  • Determining if an inputted file name exists?
    T TabascoSauce

    Hmm I must be doing something wrong with a different part of my code then. I am trying to delete a file (in the same directory as the application) with a name that is respective to whats in a list box. For example there is a "doom.txt" file and the word "doom" in my list box. I select doom and hit the delete button and the "doom.txt" file should disappear. (what I'm doing is actually more complicated, but this is the part I'm having trouble with) Here is what my code looks like:

    		    if (roomList->SelectedIndex != -1 && delCheck->Checked)
    			{
    				roomList->Items->RemoveAt(roomList->SelectedItem);
    				File::Delete(String::Concat(Convert::ToString(roomList->SelectedValue), ".txt"));
    			}
    

    Any idea what I did wrong? Thanks for all the help :)

    Managed C++/CLI help question csharp c++ tutorial

  • Determining if an inputted file name exists?
    T TabascoSauce

    Lol thanks! I actually just did this right before you linked me. But um, since I'm here. You wouldn't happen to know how to get the string value of a selected item in a list box would you?

    Managed C++/CLI help question csharp c++ tutorial

  • Determining if an inputted file name exists?
    T TabascoSauce

    Thanks for looking at my question! I am trying to figure out how to determine if a user-inputted file name exists, and I am completely unsure how to do this in .net C++. I have tried just using the C fopen code:

    if (fopen(String::Concat(room, ".txt"), "r") == 0)

    (room is the inputted variable name, and .txt is obviously the file extension) But I get a "cannot convert System::String ^ to const char *" error. I am assuming this is because fopen requires a constant name like "Bedroom.txt" and wont accept a variable as part of the name, so I need help determining another way to see if a file exists. Any help would be greatly appreciated. Thanks!

    Managed C++/CLI help question csharp c++ tutorial

  • [Message Deleted]
    T TabascoSauce

    [Message Deleted]

    Managed C++/CLI

  • Questions about string manipulation
    T TabascoSauce

    Thanks N a v a n e e t h! **Edit Ok, I got it now! Thanks very much!

    modified on Tuesday, April 21, 2009 10:06 PM

    Managed C++/CLI tutorial data-structures help

  • Questions about string manipulation
    T TabascoSauce

    Hey guys, thanks for looking at my questions! First off, I am making a program that changes words into pig-latin form, here is an explanation of that: If a words starts with a vowel (including y), simply add -way to the end of the word (ex. "alphabet" would be alphabet-way). If a word starts with a consonant, move the section of the word up till the first vowel and put it at the end with "ay" attatched to it (ex. "lame" would be "ame-lay" and glucose would be "ucose-glay") On to the questions: I'm having some trouble figuring out how to determine the length of a word to a vowel. An example would be that the length of the word "Chair" up to the first vowel is 2. Also, I am having trouble using the String::Compare method to determine if a word even starts with a vowel (see code block at the bottom). I believe the syntax is String::Compare(string1, subscript1, string2, subscript2, count) and it returns a value of 0 if string1 is equivalent to string2, please correct me if I am wrong. I used an array containing all of the vowels and used it as string2 and had the word to compare it it to as string1 with the subscripts and count set up accordingly but it does not seem to return a value as I expected. Ok, I realize this probably made no sense without any code, so here is what I have so far (problem areas bolded):

    private: System::Void button1\_Click(System::Object^  sender, System::EventArgs^  e) 
    		 {
    			 //Variables
    			 String ^transformy = ""; //User input from text box
    			 String ^transformed = ""; //Label displaying transformed word
    			 String ^beginning = ""; //Beginning of transformed word
    			 String ^end = ""; //End of transformed word
    			 array<String ^>^vowels = {"a", "e", "i", "o", "u", "y"}; //Vowels
    			 int VowelOrNot = 0; //See code
    			 int toVowel = 0; //Distance to first vowel
    			 int toEnd = 0; //Distance from vowel to end of word
    
    			 //Get user input from uIn text box
    			 transformy = Convert::ToString(uIn->Text);
    
    			 **//Determine if the first letter is a vowel by comaring the first letter of user input to vowels array
    			 VowelOrNot = String::Compare(transformy, 0, Convert::ToString(vowels), 0, 1);;
    			 if (VowelOrNot == 0)
    			 {
    				 //If VowelOrNot says that the first letter is equal, then simply add -way to the end of the word**
    				 transformed = String::Concat(transformy, "-way");
    				 //Output the new word in the pOut Label
    				 pOut->Text = Convert::ToString(transformed);
    			 }
    			 else
    			 {
    				 **//Det**
    
    Managed C++/CLI tutorial data-structures help

  • Having a program create its own variables? [modified]
    T TabascoSauce

    **Edit** Oh wow after doing a ton of research and reading I got everything to work! Thank you very much!

    modified on Sunday, March 15, 2009 8:22 PM

    Managed C++/CLI help tutorial question lounge

  • Having a program create its own variables? [modified]
    T TabascoSauce

    Hello, thanks for looking at this! I am a fairly new programmer just trying to learn new things so try to bear with me. Here is my problem: I don't know how to code something that creates new variables that store values that change per repetition of a loop. To clarify, here is my situation: I am building a math flashcard program that has 3 forms. The first is irrelevant to the question. The second form uses the rand() function to make up 2 numbers for the user to either add or subtract, they enter their answer into a textbox and then hit a button that stores their answer and gives them new numbers to work with (this happens 10 times). The third box is supposed to display the questions and correct answers of the randomly generated questions. Further clarification of my problem using an example of what happens to me: 1st Iteration of loop starts: 1. Random number generator gives the numbers 2 and 3 for the user to add 2. User enters 5 and hits the continue button 3. The continue button stores the numbers 2, 3, and 5 as variables named "1num", "2num", and "ans" respectively. 2nd Iteration of loop starts: 4. The button gives the user new numbers 5. Random number generator gives the numbers 4 and 5 for the user to add 6. User enters 9 and hits continue button 7. The continue button overwrites the previous values for "1num" 2num and "ans" with 4, 5, and 9 So on so forth I hope I am being clear enough on what my problem is. Basically I think I need to include something in the loop that makes new variables to store the new values so it doesn't overwrite previous ones. Oh boy that was fun to try to explain. If there is any confusion feel free to ask questions. Thanks for any help!!! ***Oh Geez! Edit*** So after coding some, I realized that I can't even get my program to open the other forms correctly, I have: #include "DoMath.h" Form^ DoMath = gcnew Form(); DoMath->Show(); and that opens up a new form when I hit the button on my first form, but its just a blank form, its not my DoMath form. Uhg, I just googled this and tried like 10 different ways, and all of them either don't work or do the same exact thing my code does. It would be much appreciated if someone could give me the correct code for this.

    modified on Sunday, March 15, 2009 4:14 AM

    Managed C++/CLI help tutorial question lounge

  • Updating a label's text automatically? (New programmer)
    T TabascoSauce

    Thanks for the help! I will experiment with the Double.TryParse() after I can get the intended effect from the rest of my program. I figured out how to stop my program from freezing and keep the do_while, (I also did it without the do_while, but my assignment is to make the program using do_while), but I still do not have the intended effect. northT (the label that displays the total) will update when I click on it, but I need it to update every time one of the values in the text boxes change. Here is the updated version of my code.

    private: System::Void northT_Click(System::Object^ sender, System::EventArgs^ e)
    {
    //Variables
    double nTotalIn = 0.0;
    double nTotalFi = 0.0;
    double n1 = 0.0;
    double n2 = 0.0;
    double n3 = 0.0;

    		 do
    		 {
    			 nTotalIn = Convert::ToDouble(northT->Text);
    			 n1 = Convert::ToDouble(north1->Text);
    			 n2 = Convert::ToDouble(north2->Text);
    			 n3 = Convert::ToDouble(north3->Text);
    			 nTotalFi = n1 + n2 + n3;
    			 northT->Text = nTotalFi.ToString();
    		 } while(nTotalFi != nTotalIn);
    	 }
    
    Managed C++/CLI question json help

  • Updating a label's text automatically? (New programmer)
    T TabascoSauce

    Thanks for looking at my question! I am a fairly new programmer, so please bear with me. I am trying to make a program that takes the user-inputted values from 3 text boxes, adds them together, then displays the total as a label that I placed next to the boxes in real time-(as in the number updates automatically every time the number in one of the text boxes is changed). Also, how do I make sure the value that is inputted is only numbers? Ok, here is what I have got so far. Obviously it doesn't work because I am asking this question. north1, north2, and north3 are the three text boxes and northT is the label next to them. The rest is pretty easy to understand from the code.

    private: System::Void northT_Click(System::Object^ sender, System::EventArgs^ e)
    {
    //Variables
    double nTotal = 0.0;
    double n1 = 0.0;
    double n2 = 0.0;
    double n3 = 0.0;

    		 do
    		 {
    			 n1 = Convert::ToDouble(north1->Text);
    			 n2 = Convert::ToDouble(north2->Text);
    			 n3 = Convert::ToDouble(north3->Text);
    			 nTotal = n1 + n2 + n3;
    			 northT->Text = nTotal.ToString();
    		 } while(nTotal > 0);
    	 }
    

    Again, thanks for looking, and any help will be greatly appreciated.

    Managed C++/CLI question json help

  • Converting int to string confusion
    T TabascoSauce

    I've been working my way out of the console apps and I am now trying to learn how to use windows forms in visual studio 2008. Anyway, onward to the question. I am trying to display a numerical value as text in a label on a windows form. I looked around for an answer on the internet and I found some, but I couldn't get them to work for me. So I decided to start from scratch and just ask this forum for help. Here's the section of code I'm dealing with, I bolded my problem areas. Oh and to avoid confusion, click this: http://img100.imageshack.us/img100/4479/form1w.jpg. Its a picture of my form with all of the variables and etc labeled.

    private: System::Void numberDisp_Click(System::Object^ sender, System::EventArgs^ e)
    {
    numberDisp->Text = ticketNumber->Value
    }
    private: System::Void priceDisp_Click(System::Object^ sender, System::EventArgs^ e)
    {
    //Variable
    int tickNum = 0;
    double price = 0;

    		 //Get # of tickets
    		 tickNum = ticketNumber->Value;
    		 
    		 //Calculate Price
    		 if (locB->Checked == true)
    		 {
    			 price = tickNum \* 75;
    		 }
    		 if (locP->Checked == true)
    		 {
    			 price = tickNum \* 30;
    		 }
    		 if (locL->Checked == true)
    		 {
    			 price = tickNum \* 21;
    		 }
    
    		 //Display Price
    		 **priceDisp->Text = price;**
    	 }
    
    Managed C++/CLI help csharp visual-studio winforms tutorial

  • Help with number to string conversion
    T TabascoSauce

    Bah, sorry about the forum :( This is the second time I've done this (accident).

    C / C++ / MFC help csharp visual-studio winforms tutorial

  • Help with number to string conversion
    T TabascoSauce

    I've been working my way out of the console apps and I am now trying to learn how to use windows forms in visual studio 2008. Anyway, onward to the question. I am trying to display a numerical value as text in a label on a windows form. I looked around for an answer on the internet and I found some, but I couldn't get them to work for me. So I decided to start from scratch and just ask this forum for help. Here's the section of code I'm dealing with, I bolded my problem areas. Oh and to avoid confusion, click this: http://img100.imageshack.us/img100/4479/form1w.jpg[^]. Its a picture of my form with all of the variables and etc labeled.

    private: System::Void numberDisp_Click(System::Object^ sender, System::EventArgs^ e)
    {
    numberDisp->Text = ticketNumber->Value
    }
    private: System::Void priceDisp_Click(System::Object^ sender, System::EventArgs^ e)
    {
    //Variable
    int tickNum = 0;
    double price = 0;

    		 //Get # of tickets
    		 tickNum = ticketNumber->Value;
    		 
    		 //Calculate Price
    		 if (locB->Checked == true)
    		 {
    			 price = tickNum \* 75;
    		 }
    		 if (locP->Checked == true)
    		 {
    			 price = tickNum \* 30;
    		 }
    		 if (locL->Checked == true)
    		 {
    			 price = tickNum \* 21;
    		 }
    
    		 //Display Price
    		 **priceDisp->Text = price;**
    	 }
    
    C / C++ / MFC help csharp visual-studio winforms tutorial

  • ToUpper and ToLower part of a string in .net C++?
    T TabascoSauce

    Ahhh, Ok I understand now. Thanks for the help! After I busted through like 100 other errors I had in my program I finally got it to work. You're a lifesaver, have a good day!

    Managed C++/CLI tutorial question csharp c++ help

  • ToUpper and ToLower part of a string in .net C++?
    T TabascoSauce

    Hey thanks for the help! Sadly I am still having issues, after I tried to build it the build log gives me the error: "1>.\TempConverter.cpp(37) : error C2440: 'return' : cannot convert from 'System::String ^' to 'int' 1> No user-defined-conversion operator available, or 1> There is no context in which this conversion is possible Here's the block of code I have your second suggestion in (yes I am very, very new to programming, I'm trying to overachieve on an assignment in my online class):

    //Determining student access and calculating desired conversion 
    if (name->CompareTo("ALPHA" || "BETA" || "GAMMA") != 0)
    {
    	//Display no-access message & end program 
    	Console::WriteLine("Sorry, you have insufficient rights to access to this program");
    	Console::Write("Please enter 1 to end the program: ");
    		endProgram = Convert::ToInt16(Console::ReadLine());
    }
    else
    {
    	//Greeting and user input 
    	if (name->CompareTo("ALPHA" || "BETA" || "GAMMA") == 0)
    	{
    		**using namespace System::Threading;
     return Thread::CurrentThread->CurrentCulture->TextInfo->ToTitleCase(name);
    	Console::WriteLine("Hello ", initial->ToUpper() , ". ", name);**
    	Console::Write("Are you converting from celsius or fahrenheit?: ");
    	tempr = Convert::ToString(Console::ReadLine()->ToLower());
    	}
    

    I'm trying to get it to write something like "Hello M. Beta" Feel free to point anything else I've done wrong (to an expert this probably looks horrible). Again thanks for your time and anymore help you can give me!

    modified on Sunday, February 15, 2009 6:31 PM

    Managed C++/CLI tutorial question csharp c++ help

  • ToUpper and ToLower part of a string in .net C++?
    T TabascoSauce

    Thanks for looking at my question, I am wondering how I would use the ToUpper and ToLower functions on only part of a string in .net C++. For example, I converted an inputted name to all caps for the purpose of comparing it. Now I need to display the name with only the first letter capitalized. In short, I need to make "BRAD" to "Brad" Note that the inputted name is not always the same, so however you can show me how to do this has to work with any inputted name. Thanks for any help!!

    Managed C++/CLI tutorial question csharp c++ help

  • ToUpper and ToLower part of a string in .net C++?
    T TabascoSauce

    Thanks for the help, sorry about the wrong forum, I'll repost there.

    C / C++ / MFC tutorial question csharp c++ help

  • ToUpper and ToLower part of a string in .net C++?
    T TabascoSauce

    Thanks for looking at my question, I am wondering how I would use the ToUpper and ToLower functions on only part of a string in .net C++. For example, I converted an inputted name to all caps for the purpose of comparing it. Now I need to display the name with only the first letter capitalized. In short, I need to make "BRAD" to "Brad" Note that the inputted name is not always the same, so however you can show me how to do this has to work with any inputted name. Thanks for any help!!

    C / C++ / MFC tutorial question csharp c++ help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups