473,669 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NEED HELP IN C++

Hello

I need some small help in the Borland C++ Builder.
I need to do something with string in format like "var1|var2|var3 |var4|" and
add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2") etc.).

Help me, please. How can i do it in the "while" function or something?

Best regards
Martin


Jul 19 '05 #1
17 5401
Marcin Borkowski wrote:
I need to do something with string in format like "var1|var2|var3 |var4|"
and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2")
etc.).


use the AnsiString.

there are 2 methods. substr and pos ( or strpos ).

AnsiString tmp = "var1|var2|var3 ";
int charPos = tmp.pos("|");

so you have the position of the |
and with the substr you can copy the part you want

syntax: substr(index, count);

example:
Items->Add(tmp.substr (0, charPos));

delete the elemnt you added and repeat that until pos returns an error.
--
Greetings

Wolfgang
Jul 19 '05 #2
don't work :(
i don't know c++ very well but i need to do some changes in source code that
i have got :(

PLEASE, could you write me some whilte instruction 4 this problem?
I only need to add informations from string in format "var1|var2|var3 " to
the ComboBox:

It should create something like this:

ComboBox -> Items->Add("var1");
ComboBox -> Items->Add("var2");
ComboBox -> Items->Add("var3");

Adn i don't know how can i do it in while instruction :(

PLEASE, PLEASE and one more time ------> PLEASE :(

Best regards,
Martin
Użytkownik "Wolfgang Senfter" <ws@wwww.at> napisał w wiadomości
news:3f******@e-post.inode.at.. .
Marcin Borkowski wrote:
I need to do something with string in format like "var1|var2|var3 |var4|"
and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2")
etc.).


use the AnsiString.

there are 2 methods. substr and pos ( or strpos ).

AnsiString tmp = "var1|var2|var3 ";
int charPos = tmp.pos("|");

so you have the position of the |
and with the substr you can copy the part you want

syntax: substr(index, count);

example:
Items->Add(tmp.substr (0, charPos));

delete the elemnt you added and repeat that until pos returns an error.
--
Greetings

Wolfgang

Jul 19 '05 #3


Marcin Borkowski wrote:

don't work :(
i don't know c++ very well but i need to do some changes in source code that
i have got :(


Hire a programmer to do it.
That's what we are paid for.
--
Karl Heinz Buchegger
kb******@gascad .at
Jul 19 '05 #4
If you don't know answer 4 my question, don't post, please.
This is not the shop with help.
Użytkownik "Karl Heinz Buchegger" <kb******@gasca d.at> napisał w wiadomości
news:3F******** *******@gascad. at...


Marcin Borkowski wrote:

don't work :(
i don't know c++ very well but i need to do some changes in source code that i have got :(


Hire a programmer to do it.
That's what we are paid for.
--
Karl Heinz Buchegger
kb******@gascad .at

Jul 19 '05 #5
Marcin Borkowski wrote:
If you don't know answer 4 my question, don't post, please.
This is not the shop with help.


Don't top post.

http://www.parashift.com/c++-faq-lit...t.html#faq-5.4

And don't demand help. Ask. So far you have got all what you have payed
for.

--
Attila aka WW
Jul 19 '05 #6


Marcin Borkowski wrote:

If you don't know answer 4 my question, don't post, please.
This is not the shop with help.


1) Don't top post
2) It would be good idea to actually *show* us what
doesn't work.
What have you tried?
What results did you get?

Don't write: "don't work :("
But instead write: I used this code

<insert your code here>

but it does not do <insert what you expect your code to do>

and somebody will show you how it's done. You actually might
learn something by doing so.
But be warned: no Borland extensions. We discuss standard C++
only in this NG. The std::string class can do perfectly what
you want to do.

--
Karl Heinz Buchegger
kb******@gascad .at
Jul 19 '05 #7
Wolfgang Senfter <ws@wwww.at> writes:
Marcin Borkowski wrote:
I need to do something with string in format like "var1|var2|var3 |var4|"
and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2")
etc.).


use the AnsiString.


Please don't post OT answers - AnsiString is not a part of standard C++.
Use std::string instead.

kind regards
frank

--
Frank Schmitt
4SC AG phone: +49 89 700763-0
e-mail: frankNO DOT SPAMschmitt AT 4sc DOT com
Jul 19 '05 #8
Marcin Borkowski wrote:
If you don't know answer 4 my question, don't post, please.
This is not the shop with help.


You should ask this question on Borland's newsgroups.
You can sign up at (hold on while I google for
"Borland newsgroups", just a second ... )
http://info.borland.com/newsgroups/ng_cbuilder.html

I don't have Builder installed so I can't look this stuff
up in the help files or test my code. You'll gave to check
the details yourself.

// Put these declarations in the 'TForm1' class
// in the 'Unit1.h' file.
TComboBox * ComboBoxes [4];
void __fastcall FillComboBoxes (AnsiString s);
struct EFillComboError { };

// Put this in the 'TForm1' constructor in 'Unit1.cpp'.
ComboBoxes [0] = ComboBox1;
ComboBoxes [1] = ComboBox2;
ComboBoxes [2] = ComboBox3;
ComboBoxes [3] = ComboBox4;

// Put this definition in 'Unit1.cpp'.
void __fastcall TForm1::FillCom boBoxes (AnsiString AString)
{
std::auto_ptr <TStringList> StringList (new TStringList);

StringList->Delimiter = "|"; // ?? Check in help.
StringList->DelimitedTex t = AString;

if (StringList->Count != 4) throw EFillComboError ();

for (int i = 0; i != 4; ++ i)
ComboBoxes [i]->Text = StringList->Strings [i];
}

Jul 19 '05 #9
Buster Copley <bu****@none.co m> spoke thus:
You should ask this question on Borland's newsgroups.


A noble thought, but from what I can see very few people post there. OP would
probably do better on comp.os.ms-windows.program mer.win32.

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cybers pace.org |
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2436
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its last year we got traffic of between 2000 - 2500 unique visitors per day. We are now about to re-launch the site from Sweden and we need to purchase a script to run it. Having looked at what is available on the net I have realised that we need a...
6
2171
by: Robert Maas, see http://tinyurl.com/uh3t | last post by:
System login message says PHP is available, so I tried this: http://www.rawbw.com/~rem/HelloPlus/h.php It doesn't work at all. Browser just shows the source. What am I doing wrong?
0
2427
by: Gregory Nans | last post by:
hello, i need some help to 'tree-ify' a string... for example i have strings such as : s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i need))""" and i need to parse them to have a tree representation such as :
7
4384
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a few features that you'd expect in any editor, except nearly none of them seem to have: 1 - Search and repalce with Regular Expressions. 2 - Search and Replace in an Xpath context. 3 - User specified tag-generation for either on a...
8
2834
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl list class must Ioverride in order for this to work?
3
2623
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If you need more detail I can be glad to prove all my points. Our goal is to make logical systems. We don't want php,perl, or c++ making all the procedure calls and having the host language to be checking for errors and handleing all the...
2
1946
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a valid IP Address", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Hand) txtIPAddress.Focus() Return End If
8
2737
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only the sequence nos and it should be such that i can access it through the structure .plz help me .
11
4485
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any AutoNumber* fields in them. Correct me if I'm wrong, but I'm assuming this means that I cannot now alter these existing Access tables and change their primary key to an "AutoNumber" type. If I'm right about this, I need some suggestions as to the...
0
3946
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need Inbox Reply from Craig Somerford <uscos@2barter.net> hide details 10:25 pm (3 minutes ago)
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.