C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,759 questions
I know how to connect to the DB already, i have done so previously for the Add New button and Update button, where im struggling is adding the data into my richtextbox when the Notes button is pressed.that might be the container or output part that you're talking about. and it needs to be richtextbox because i need to be able to write more notes in the function. i'm using "newtable.new_table".
How did you design the database? Can you provide example you want the data to be displayed in the richtextbox?
I didn't find anything about the newtable.new_table database. Is it a database product like Access?
I want to get the Notes table to open in the Notes button.
it's just a normal database i made.
Try to read the contents of the Notes column by looping and pass it in gcnew MyForm1().
I'm not sure how to do that.
Since I don't know which database you are using, I assume you have read the full table.
Read Notes data :
The form1 Constructor
I'm sorry, I don't understand your problem. If you can already read from the database, then you know the data of each row and you have a variable for your "Notes" column (normally text).
Since you can update the data in your table, you should also know, how to get the current selected row in your table, so you can get the value in the "Notes" column.
If you don't know how to get and set text in a richtextbox, read the documentation or search for examples, e.g.
cpp-richtextbox-class-examples.html
i am recieving an undefined error with mTable and myAL are these supposed to be my database? I'm sorry i dont think i understand where exactly to implement the for statement.
myAL is declared (type ArrayList) in Myform.h and used in
myAL->Add(row["Notes"]->ToString())
;. DataTable stores database tables.For example:
Sign in to comment
Hi, @Hector Agosto
This is the test example. Click button2 to read data and click button1 to show the Form1.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
I see you have two buttons, im wondering how to do it with just the one button. everything works when i use two buttons. i've set it up just how you've shown me. now i'm trying to make it work with just one button. if i select to open the notes again the information seems to duplicate. any idea how to fix this duplication error?
Set a flag to prevent duplicate reads.
Sign in to comment
1 additional answer
Sort by: Most helpful
isnt working .
Did the previous code work? you can modify the constructor:
MyForm1(The type of your txtRef->Text txt, ArrayList^ text)
im receiving an error with the ArrayList type name is not allowed. im not sure if it works yet because i havent gotten this form loader able to hold two arrays.
You need to modify your MyForm1 constructor in MyForm1.h.
Modify the type of your txtRef->Text below
i dont have txtRef inside MyForm1 its a textbox variable inside of MyForm that i pass to a label when i click notes.
im getting a type name is not allowed for ArrayList^Text. sorry this is frustrating. the rest of the code is plugged in, i'm just not sure how to pass this array since i already have one constructor .
if i try to use .
i get Severity Code Description Project File Line Suppression State
Error (active) E0289 no instance of constructor "Project4::MyForm1::MyForm1" matches the argument list Project4 C:\Users\hagos\source\repos\Project4\Project4\MyForm.h 569
Use string to receive txtRef->Text. Constructor:
MyForm1(String^ txt,ArrayList^ text)
i suppose it takes more than just
because this gave me errors as well.
What is your type of txtRef? Can you provide the error message.
all i'm trying to do now is add a second constructor to
if i just use myAL it doesnt show my notes that are in the db either.
Did you read database table into DataTable^ mTable?
the
part? i have that in the initialize form part. whats it supposed to look like?
This part is used to store the contents of Column Notes into an ArrayList. You can put the snippet after reading database into DataTable^ mTable.
Sign in to comment
Activity