Hey guys, I have some code set up to iterate through a nested map. It current works as expected, iterating through all values in the first key, and then the second key. My question is, is there any way to display one value from each key? For example, if key 0 contains a vector containing **a b c d** and key 1 contains a vector containing **1 2 3 4**, would there be any way to output **a 1 b 2 c 3 d 4**, instead of **a b c d 1 2 3 4**? I hope the question is …

Member Avatar
Member Avatar
+0 forum 2

Hey Guys, I'm pretty new to containers, but need to use them for a project I'm doing. I've figured out that I can use a map iterator to iterate through values stored in the map displaying the key, followed by the second value. In my case, the key is an`int` and the second value is a nested vector of the form `vector<vector<double> >`. My question is how would I go about using a the map iterator to display the contents of the second value? Would I need a for loop somewhere? Here's the relevant code snippet. map<int, vector<vector<double> > >::iterator …

Member Avatar
Member Avatar
+0 forum 8

Hi! So yesterday when trying to run a program that previously ran perfectly, I received the error shown in the title and I've no idea why. Nothing that could have caused such error was changed, so I've absolutely no idea what the problem could be. Here's the code the error points to. wbook = new XSSFWorkbook(); input = new FileInputStream("ATM.xlsx"); wbook = WorkbookFactory.create(input); //<<< this is the line there seems to be a problem with Any ideas? Thanks! -I'm using Apache POI to write to and read from excel files.

Member Avatar
Member Avatar
+0 forum 1

Hey! Firstly, here's the code: for (Row row : sheetToSearch) { for (Cell cell : row) { if(cell.toString().equals("Oladimeji")){ System.out.println("Found Oladimeji!!"); break; } else { System.out.println("Oladimeji not found...."); } } } What this does is search through the an excel spreadsheet, looking for a name (which happens to be my surname!). It is located in the sheet once, and displays the relevant message when found. However, the loop does not exit as expected, and just keeps iterating. Any ideas as to why? Thanks!

Member Avatar
Member Avatar
+0 forum 2

Hey, I am trying to make use of the apache POI in my Java project in Eclipse. I previously tried using jxl but what I wanted to do didn't seem so simple with it. With jxl, all I had to do was import a jar. I don't seem to be able to find a jar in the apache download. Help please? Thanks!

Member Avatar
Member Avatar
+0 forum 2

Hi! Firstly, here's the code: if(new File("ATM.xls").exists()){ System.out.println("File exists"); } else{ File excel = new File("ATM.xls"); } What I'm trying to do is check whether or not a file exists and then create said file, if it does not exist. This all works fine, but somehow, I'm unable to use this created file in any way outside my IF statement. I'm trying to do the following: WritableWorkbook wb = Workbook.createWorkbook(excel); It's not working, and I'm not sure why. Any ideas?? Thanks for all help in advance :)

Member Avatar
Member Avatar
+0 forum 5

Hi, I seem to be having a problem when attempting to insert a new record into my database through vb.net. From what I can gather, there seems to be an error in the code that the command builder (cBuilder) is creating for me. Here's a copy of the code for the connection: [CODE]Private Sub btnLoadDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadDB.Click Provider = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;" Source = "Data Source = C:\Documents and Settings\Hp\My Documents\COMP4\COMP4 CW\WND.accdb" connection.ConnectionString = Provider & Source connection.Open() sqlCode = "SELECT * FROM Customers" dAdapter = New OleDb.OleDbDataAdapter(sqlCode, connection) dAdapter.Fill(dSet, "Customers") MsgBox("Database Loaded.", MsgBoxStyle.Information) connection.Close() …

Member Avatar
Member Avatar
+0 forum 7

Hi, I seem to be having a problem with my code below, which I would like to be able to use to return 2 values from the result of a quadratic equation operation. The eReturn function takes care of negative square root values. I'm not getting any errors back, just both of my results as 0. #include <stdio.h> #include <stdlib.h> #include <math.h> void eReturn() { printf("\nOne or both of your answers is complex.\n"); return; } void QuadFormula(float a, float b, float c) { float x1, x2, y, dis, *d, *e; dis = ((b*b)-(4*a*c)); if (dis<0) eReturn(); else if (dis>0) { …

Member Avatar
Member Avatar
+0 forum 3

HI, I'm having a problem with saving some text in a while using the FileOpen Method, as shown below. Dim Filename As String Dim text As String = "Testing Testing" Console.Write("Enter new file name: ") Filename = Console.ReadLine Console.WriteLine() FileOpen(1, Filename , OpenMode.Binary, OpenAccess.Write) FilePut(1, text) FileClose(1) I'd appreciate it if somebody could show me how to use this method correclty? (i.e. where would i insert the filepath?) Thanks in advance :) Collin

Member Avatar
Member Avatar
+0 forum 1

Hi, The code shown below sucessfully saves text onto a line in a txt document, but using the array, I want to be able to save each piece of text on a separate line. How would I do this? Thanks in advance :) Dim filePath As String Dim objectWriter As StreamWriter Dim text(3) As String Dim int As Integer Sub Main() filePath = "C:\College.txt" objectWriter = New StreamWriter(filePath) For int = 0 To 3 Console.Write("Enter something here: ") text(int) = Console.ReadLine objectWriter.Write(text(int)) Next objectWriter.Close() Console.WriteLine("Text has been saved.") Console.ReadLine() End Sub

Member Avatar
Member Avatar
+0 forum 2

Hi, I have a form in VB which is scrollable (using autoscroll) and when I currently click 'print', it only prints what I can see; it takes a screenshot of the viewable information. Here's my code: [CODE]Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click Dim settings As New System.Drawing.Printing.PrinterSettings sPrintForm.PrinterSettings = settings settings.DefaultPageSettings.Landscape = True sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview sPrintForm.Print() End Sub[/CODE] Could somebody please show me how to print the whole of the page, including the areas that can't be seen? Thanks in advance :) (See attached file for image)

Member Avatar
Member Avatar
+0 forum 8

Hi, I was wondering if it is possible to send an e-mail through VB.NET, and if so, how it is done? Thanks Collin

Member Avatar
Member Avatar
+0 forum 1

Hi, I have a form in VB which is scrollable (using autoscroll) and when I currently click 'print', it only prints what I can see; it takes a screenshot of the viewable information. Here's my code: [CODE] Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click Dim settings As New System.Drawing.Printing.PrinterSettings sPrintForm.PrinterSettings = settings settings.DefaultPageSettings.Landscape = True sPrintForm.PrintAction = Printing.PrintAction.PrintToPreview sPrintForm.Print() End Sub [/CODE] Could somebody please show me how to print the whole of the page, including the areas that can't be seen? I've already tried using [CODE]PrintForm.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable)[/CODE] and that didn't work. Thanks in advance …

Member Avatar
Member Avatar
-1 forum 3

Hi, I am having problems with deleting part of a record. The record has approximately 15 different fields, and I only wish to delete 3 of them using the following piece of SQL coding: DELETE [PMID 1], [PMName 1], [Price 1] FROM Subscriptions WHERE [Customer ID]="001" The code works absolutely fine, but it just doesn't do what I want it to. Instead of deleting those 3 fields, it deletes the entire row, which isn't very helpful. Any ideas on how to solve this problem? Thanks in advance :)

Member Avatar
Member Avatar
+0 forum 2

Hi, I keep getting the error: Object reference not set to an instance of an object. When attempting to check if a database record is Null or not using the line: [CODE] If IsDBNull(dSet.Tables("Subscriptions").Rows(incr).Item(8)) = True Then addsub2() End If [/CODE] I'm sure that I have opened and closed the database correctly, so I'm not sure what excactly the problem is. Any Ideas? Thanks In Advance.

Member Avatar
Member Avatar
+0 forum 6

Hi, I am trying to split a single line of data into three separate parts so that they can be displayed in different textboxes. The data looks like this: item1_item2_item3 The code that I tried is: [CODE]Dim arrayLines() As String Dim record As String record = Subs.Text arrayLines = record.Split("_") TextBox1.Text = arrayLines(0) TextBox2.Text = arrayLines(1)[/CODE] I don't seem to have much luck, I don't even get an error message when I click on the button. Any suggestions..?

Member Avatar
Member Avatar
+0 forum 2

Hi, Could somebody provide me with an example of how to display data (some text) in a combobox? Thanks Collin

Member Avatar
Member Avatar
+0 forum 13

Hi, I have a database with lots of fields, some of which are still empty and are to be filled in at a later stage. Is there any way of writing an IF statement (or any other method) that will allow these empty records to be 'shown' in my textboxes in Visual Studio, without receiving the error: [CODE]Conversion from type 'DBNull' to type 'String' is not valid.[/CODE]? Thanks in advance. Collin

Member Avatar
Member Avatar
+0 forum 6

Hi, I have a textbox called [CODE]txtCustomerRecord.text[/CODE]. It is a multiline textbox, and I want to be able to enter different pieces of information (info1, info2, info3) into each line. I would really appreciate it if somebody could show me how to do this. Collin

Member Avatar
Member Avatar
+0 forum 16

Hi, I was wondering if anybody could help me with printing a displayed form to a printer. This is my current code. (I am using the PrintForm visual basic PowerPack.) [CODE] Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click cPrintForm.PrintAction = Printing.PrintAction.PrintToPreview cPrintForm.Print() End Sub[/CODE] This prints the form fine, but the problem is that the page printed is portrait, and my whole form doesn't fit on it, so I was wondering how to set it to landscape? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hi, I seem to be having a problem with displaying data in a second form. I've created a linear search algorithm which works just fine - it locates the records from the database. I now want to be able to display the record in another form, I've attempted this using the code below but it doesn't seem to work: [CODE] Public Class formSearch Dim searchItem As String Dim currentRecord As Integer Dim Provider As String Dim Source As String Dim connection As New OleDb.OleDbConnection Dim sqlCode As String Dim dAdapter As New OleDb.OleDbDataAdapter Dim dSet As New DataSet Dim maxRows, …

Member Avatar
Member Avatar
+0 forum 22

Hi, I seem to be getting the error "Syntax error in UPDATE statement." when attempting to update my database through visual studio 2008, using forms. Here is the code for the connection: [CODE]Private Sub btnLoadDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadDB.Click Provider = "PROVIDER=MICROSOFT.ACE.OLEDB.12.0;" Source = "Data Source = F:\My Documents\Computing\COMP4\COMP4 CW\WND.accdb" connection.ConnectionString = Provider & Source connection.Open() sqlCode = "SELECT * FROM Newspapers" dAdapter = New OleDb.OleDbDataAdapter(sqlCode, connection) dAdapter.Fill(dSet, "Newspapers") MsgBox("Database Loaded.", MsgBoxStyle.Information) connection.Close() maxRows = dSet.Tables("Newspapers").Rows.Count incr = -1 End Sub[/CODE] The code for the update button on my form: [CODE] Private Sub btnUpdate_Click(ByVal sender …

Member Avatar
Member Avatar
+0 forum 6

The End.