473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to create a static negation sign (-) in a textbox

Hi community experts,

Environment
MS Acess, visual basic

May i knw whether is there a way to create a static negation sign (-) in a textbox? Is there a possiblity that this can be done using expression builder or code wise. If so hw can it be achieved? It mean that whenever the form is being loaded, the negation sign will be there and it mux be static. tks
Jan 30 '07 #1
13 2006
NeoPa
32,556 Expert Mod 16PB
Set the Control Source of the control to (="-").
Jan 31 '07 #2
NeoPa
32,556 Expert Mod 16PB
I don't know what you mean by being static in this context.
Try it out, if it does what you want fine, just post back confirming. If it doesn't, just let us know what else you need as clearly as you can.
Jan 31 '07 #3
Killer42
8,435 Expert 8TB
I think it's the Input Mask you're looking for.
Jan 31 '07 #4
NeoPa
32,556 Expert Mod 16PB
I don't get that from the question.
That wouldn't display the minus (-) on opening the form...
Jan 31 '07 #5
Killer42
8,435 Expert 8TB
I don't get that from the question.
That wouldn't display the minus (-) on opening the form...
I took "static" to mean that the text box should always have the minus sign there, thus forcing the entry of a negative number. I could be wrong, of course.

And I haven't tested this, just thought it was something worth looking at. Perhaps I'm mixing it up with the old Masked Edit control?
Jan 31 '07 #6
NeoPa
32,556 Expert Mod 16PB
I wasn't merely being argumentative ;)
I was interested in your thinking too.
I don't think it works like that - it would control the operator input rather than showing the character. I was wondering whether the OP actually wanted a (-) that couldn't be edited at all.
Jan 31 '07 #7
Killer42
8,435 Expert 8TB
I wasn't merely being argumentative ;)
I was interested in your thinking too.
I don't think it works like that - it would control the operator input rather than showing the character. I was wondering whether the OP actually wanted a (-) that couldn't be edited at all.
I've just been playing briefly with a text box with an input mask of "-0000" and it seems to do something kind of similar to what I expected. Maybe the OP would be better off simply placing a label on the form with a "-" in it.
Jan 31 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
I wasn't merely being argumentative ;)
I was interested in your thinking too.
I don't think it works like that - it would control the operator input rather than showing the character. I was wondering whether the OP actually wanted a (-) that couldn't be edited at all.
To settle the 'argument' ...

If the poster simply wants to display a '-' sign then the input mask can be used but this will not store the number as a negative. However, if the poster wishes to enforce a negative number be entered then the validation rule of <0 must be set in the control or table properties.

Mary
Jan 31 '07 #9
Killer42
8,435 Expert 8TB
Guess we just need to wait for some input from technocraze, now. At least we've managed to provide some ideas.
Jan 31 '07 #10
Environment
MS Acess and visual basic

Yes, NeoPa and Killer42 were right! What i need is what they have responded in the post. This mean that the entry will only take in negative sign and that sign cannot be erased, edited or replaced. Any ideas as to hw that can be achieved either through coding, expression builder or even macros?

I have been thinking hard for all possible combinations and solutions but it seems to come in vain. I am also thinking of concatenating the negative sign with the numerial values of the textbox but nt too sure hw can that be achieved.
Ex: "-" + Me.TextBox1.Value

HI guys tks for the response. To make it simple what i need is to display the negative sign in the textbox and it must be permanently there, which mean that user are not able to edit that negation sign ("-"). Whenever the form is loaded that negative sign must be there.

The purpose of the textbox in this context is used to accept a numerical value, which mean that when the user save the data to the table, the sign together with what have been entered in the textbox will be displayed.

I have tried with what some of the experts in this post have suggested such as mask and greater than 0 in the validation rule but it seems to have macro error and no value can be entered.

What i am thinking is to use the expression builder to achieve but still trying hard on that expression.

Normally, I will take the effort to try first before posting because i dnt want to take things for granted and expect the community experts to do the work for me.

Ex: Textbox1
Permanent negative sign (-)
value for the textbox - (2)
Overall it will become -2

This are the what have tried so far but to no avail.
Load event . Me.TextBox1 = "-"
Got Focus - Me.TextBox1 = "-"
Validation rule - < 0
ControlSoure - ="-"
input mask = "-"
Jan 31 '07 #11
NeoPa
32,556 Expert Mod 16PB
Try putting this procedure into your form's module :
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_AfterUpdate()
  2. On Error Resume Next 'Just in case operator enters non-numeric value
  3.     If Nz(Me!TextBox1, 0) > 0 Then Me!TextBox1 = -Me!TextBox1
  4. End Sub
It won't put the sign in as such, but will ensure that any figure entered is treated as negative regardless of the sign entered.
Jan 31 '07 #12
Cool MAN NeoPa! this is what i want to achieve. Once again tks for the concerted effort made.
Jan 31 '07 #13
NeoPa
32,556 Expert Mod 16PB
Glad to help.
Jan 31 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
2
by: asetofsymbols | last post by:
Hi i'm new to c++ i have the class num for big unsigned numbers it seems work ok until now and i want extend the numbers to big-signed and big-float typedef struct{ unsigned len; unsigned* ...
17
by: joshc | last post by:
I searched through the newsgroup for this and found the answer but wanted to make sure because of something that came up. I want the absolute value of a 'short int' so to avoid the dangers of...
6
by: SamIAm | last post by:
Hi am creating a email application that needs to mail out a very large amount of emails. I have created a multithreaded c# application that using message queuing. I have created a threadpool of 5...
4
by: James N | last post by:
Here's the situation: I have 3 webforms in my project. Form 1 allows the user to select a type of report to generate. There are 2 possible type of reports, and therefore, Forms 2 and 3 are these...
18
by: Ronald Bruck | last post by:
I have several routines which are used millions of times in my programs, using the Gnu multi-precision software's floating-point reals (see <http://www.swox.se/gmp>). These are of type mpf_t, and...
10
by: Corey B | last post by:
I have a data grid that has three columns: First Name, Middle Name, and Last Name. The grid has a list of people with a blank row at the bottom of the grid (in the footer) that allows the user to...
6
by: George Sakkis | last post by:
It's always striked me as odd that you can express negation of a single character in regexps, but not any more complex expression. Is there a general way around this shortcoming ? Here's an example...
6
by: sk.rasheedfarhan | last post by:
Hi , I am using regular expression in C++ code, . Negation is not working in the down loaded code. matches all characters except "a", "b", and "c] So I am in dilemma can negation work in C++...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.