I am adding to my software. I have placed about 30 checkboxes on a form. Based on which checkboxes are selected, I want to print the values to a tab delimited text file. For instance, the first checkbox is labeled "Depth" and corresponds to a named variable of 'depth'. If this checkbox is select, I want to print column A, or 'depth' to the file. This part is easy. I am looking for the simplest way to write to a tab delimited text file, if there are multiple checkboxes selected, say 20. But I am wanting the column to print in a certain order. My named variables are: depth(column1), fph(column2),mp f(column3),slid e(column4),pdc( column5),tgas(c olumn6),etc. Now if checkboxes "Depth", "MPF" , "Slide", & "TGas" were selected, I need the values of the columns to print in a certain order: depth, fph, mpf, slide, pdc, tgas, etc. The code I have so far is as follows: -
Public Sub PrintColumns()
-
With frmHeader
-
'all columns
-
If .colFPH.Value = 1 And .colMPF.Value = 1 And .colTGas.Value = 1 _
-
And .colMeth.Value = 1 And .colEth.Value = 1 And .colPro.Value = 1 And .colIBut.Value = 1 _
-
And .colNBut.Value = 1 And .colMWtIn.Value = 1 And .colMWtOut.Value = 1 And .colMTmpIn.Value = 1 _
-
And .colMTmpOut.Value = 1 And .colAnhy.Value = 1 And .colChalk.Value = 1 And .colLime.Value = 1 _
-
And .colDolo.Value = 1 And .colShale.Value = 1 And .colSand.Value = 1 And .colSilt.Value = 1 _
-
And .colCoal.Value = 1 And .colChert.Value = 1 And .colNoSamp.Value = 1 Then
-
Print #1, depth & vbTab & fph & vbTab & mpf & vbTab & slide & vbTab & _
-
pdc & vbTab & tgas & vbTab & c1 & vbTab & c2 & vbTab & c3 & vbTab & _
-
c4i & vbTab & c4n & vbTab & shale & vbTab & silt & vbTab & _
-
sand & vbTab & chalk & vbTab & lime & vbTab & dolo & vbTab & _
-
anhy & vbTab & coal & vbTab & chert & vbTab & nosamp & vbTab & _
-
mwin & vbTab & mwout & vbTab & mtmpin & vbTab & mtmpout
-
End If
-
-
If .colFPH.Value = 1 Then
-
Print #1, depth & vbTab & fph
-
End If
-
If .colMPF.Value = 1 Then
-
Print #1, depth & vbTab & mpf
-
End If
-
If .colSlide.Value = 1 Then
-
Print #1, depth & vbTab & slide
-
End If
-
If .colPDC.Value = 1 Then
-
Print #1, depth & vbTab & pdc
-
End If
-
If .colTGas.Value = 1 Then
-
Print #1, depth & vbTab & tgas
-
End If
-
If .colMeth.Value = 1 Then
-
Print #1, depth & vbTab & c1
-
End If
-
If .colEth.Value = 1 Then
-
Print #1, depth & vbTab & c2
-
End If
-
If .colPro.Value = 1 Then
-
Print #1, depth & vbTab & c3
-
End If
-
If .colIBut.Value = 1 Then
-
Print #1, depth & vbTab & c4i
-
End If
-
If .colNBut.Value = 1 Then
-
Print #1, depth & vbTab & c4n
-
End If
-
If .colMWtIn.Value = 1 Then
-
Print #1, depth & vbTab & mwin
-
End If
-
If .colMWtOut.Value = 1 Then
-
Print #1, depth & vbTab & mwout
-
End If
-
If .colMTmpIn.Value = 1 Then
-
Print #1, depth & vbTab & mtmpin
-
End If
-
If .colMTmpOut.Value = 1 Then
-
Print #1, depth & vbTab & mtmpout
-
End If
-
If .colAnhy.Value = 1 Then
-
Print #1, depth & vbTab & anhy
-
End If
-
-
-
'fph & mpf
-
If .colFPH.Value = 1 And .colMPF.Value = 1 Then
-
Print #1, depth & vbTab & fph & vbTab & mpf
-
End If
-
'fph,mpf,& tgas
-
If .colFPH.Value = 1 And .colMPF.Value = 1 And .colTGas.Value = 1 Then
-
Print #1, depth & vbTab & fph & vbTab & mpf & vbTab & tgas
-
End If
-
-
End With
-
-
End Sub
-
If I keep writing it like I am, I will have around 2000 lines of code to write, just to get the logic correct. Does anyone have a simpler way of doing this? I have about 25 columns of data, and only want the ones that are referenced by the checkboxes to print to a tab delimited file, but in a specific order. Any ideas?
0 1377 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Emmett Power |
last post by:
Hi,
I have a form on a web page with a number of radio buttons bound to
the same field. Is it possible to set up the form so that users can
select more than one radio button to submit multiple values to a field
in the way that you can, for example, in a drop down field?
Thanks in advance for any suggestions.
With regards
|
by: Garmt de Vries |
last post by:
On the website of the Dutch Jules Verne Society (www.jules-verne.nl),
we have several forms that visitors can use to order something, or to
apply for membership. Of course, a form's primary purpose is to be
filled out online, but I can imagine, for example, one of our members
giving a talk and printing a pile of application forms to hand out to
the audience.
I am trying to add some specific styles in the print stylesheet so the
forms...
|
by: elgin |
last post by:
I have a form which is formatted so as to print out for mailing. This
form contains several option groups with checkboxes. These checkboxes
have no data source; the state of the checkboxes are updated on the "on
current" event that pulls the data from an underlying table.
When I open the form, everything looks great, but when I do print
preview (and/or print) the checkboxes in 3 of the option groups are all
unchecked. When I cancel print...
|
by: Amer Neely |
last post by:
I've got a dynamically built form with checkboxes for each element ( a
list of file names in a directory). I need to grab only those checkboxes
that are checked, so I can then delete those files.
Does each checkbox name have to be unique? I was hoping to just group
them under one name, and select from that array.
PHP is not my native language - I'm coming at this from Perl, so bear
with me, things are a little different in that country.
|
by: ameshkin |
last post by:
What I want to do is very simple, but I'm pretty new at PHP and its a
little hard for me.
I have one page, where there are a rows of checkboxes. A button
selects all checkboxes, and then presses delete.
When delete is pressed, I want to go to a next page and run a sql
command for every single box thats checked. The checkboxes store a
value, and multiple boxes can be checked.
| |
by: prash.marne |
last post by:
hi ,
i am having a simple form
-----------------------------------------------------------------------
-----------------------------------------------------------------------
--------------
<form action="submit.php" method="POST">
<select name="activity"
onchange="if(this.options.value=='M')
|
by: =?Utf-8?B?UGV0ZXJX?= |
last post by:
I have a TabControl on a Windows form in which I have various tab pages each
with a DataGridView, the first column of which is a
DataGridViewCheckBoxColumn and subsequent columns being
DataGridViewtextBoxColumns.
In each case the properties of the CheckBoxcolumn have been set to not allow
nulls, so presumably only explicit true or false values should be possible.
I run the application and set check boxes for DataGridView rows I am...
|
by: LionsDome |
last post by:
Hello,
I have a vb.net page which a bunch of checkboxes. A user can select a
checkbox(s) and hit the submit button to store those values in a SQL
Server table. This works fine with no problem the first time the user
submits. However when user submits a second time while changing some
of the selected boxes the page only re-submits the previosly selected
checkbox values. It's like its storing it somewhere in the cache or
something. My...
|
by: TechnoAtif |
last post by:
Hi All..'mAtif..i've got stuck within checkboxes these days..i've got many input items like checkboxes,textarea and along with them there are many checkboxes...all the data except the checkbox's is comfortably getting entered into the database but the real problem is with the checkboxes..only one entry is being stored ...but i want to enter the multiple entries from the checkboxes to enter into the database...the form is a voting poll..and i...
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |