|
hi there,
I am in a little trouble here. I have a database with employee names details etc.. and I also have a child sub table for their absence. what I want my program to do:
I have a list box that loads full employee names and selects the record
once I click on it I want it to display the info from a child sub table according to the name selected.
I already know how to write to the child sub table but do not know how to display it.
any help would be appreciated.
the code I have written so far fills up the list box with all absence disregarding individual record.
this is what I've written to insert the record into the child sub table. What I want is to display all the things that I add into the list box. some man suggested to have a look at "master-detail" on google but unfortunately the code is too complicated to be able to study it in short time. I need it ASAP as I cannot start doing another piece once this is sorted.
thanks to all people who help
Holidays = txtholiday(0).Text
Sickness = txtSickness(0).Text
Off = txtOff(0).Text
Holidays1 = txtholiday(1).Text
Sickness1 = txtSickness(1).Text
Off1 = txtOff(1).Text
AbsenceID = txtid(0).Text
intDay = cboDays.Text
conConnection.Open
With cmdCommand
.ActiveConnection = conConnection
.CommandText = "SELECT * FROM tblmain WHERE fullname = '" & fullname & "';"
.CommandType = adCmdText
End With
With rstRecordSet
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open cmdCommand
End With
With cmdCommand
.ActiveConnection = conConnection
.CommandText = "INSERT into tblAbsence (AbsenceID, Holidays, Sickness, Off, Holidays1, Sickness1, Off1, DaysTaken) Values ('" & AbsenceID & "', '" & Holidays & "', '" & Sickness & "', '" & Off & "', '" & Holidays1 & "', '" & Sickness1 & "', '" & Off1 & "', '" & intDay & "')"
.CommandType = adCmdText
.Execute
End With
|
|
|
|
|
Hello Friends,
I like to accept a string and convert the case of the characters using vb .net
eg Input String : aBcDE
Output String : AbCde
depanding on the user selection
Thanks In Advance
Praveen
modified on Wednesday, May 27, 2009 5:17 PM
|
|
|
|
|
OP before modficiation
<blockquote class="FQ"><div class="FQA">Member 4514218 wrote:</div> Hello Friends,
I like to accept a string and convert the case of the characters using vb .net
eg Input String : aBcDE
Output String : ABCDE
Output String : abcde
depanding on the user selection
Thanks In Advance
Praveen </blockquote>
My Response
Check out the <code>String.ToUpper()</code> and <code>String.ToLower()</code> methods, you can use <code>Radioboxes</code> for the selection,
and read your class book before bringing homework here.
The OP first asked how to make a string either all upper or all lower case based off user selection, which is why the above post exists here. Don't want you guys thinking I posted random garble
See post below for response to *current* thread.
modified on Wednesday, May 27, 2009 5:39 PM
|
|
|
|
|
EliottA wrote: Don't want you guys thinking I posted random garble
Nah. Just making up random questions now?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: Just making up random questions now?
Those are the only ones I know the answer to
|
|
|
|
|
Keep up the good work.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
So you just want to flip each case?
Way to change the requirements after I answer your other post.
It usually goes against me to do someone's homework for them, and after I posted my other reply I initially had regret, going against my common practice.
This time I stick to it, go read your book or you will fail your course.
|
|
|
|
|
Easy. Convert to ASCII, XOR all letters with 0x20, convert back to Unicode.
Now what should happen with some specials, such as the trademark and registered signs?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Need to be able to specify a month, date, and year for a db record and use the data later to produce results based on monthly/yearly production. New to programming, have read a bit about date functions and I see a couple different ways I could go about this. Was wondering if anyone wants to steer me to the easiest, or most efficient method of going about designing the logic.
Example
Loan office has loans working, or closed. Want to be able to generate monthly/yearly projected and closed figures.
What is the best way for me to work with the dates involved?
Thanks in advance for the advice.
|
|
|
|
|
I'd store the date information in the database as Dates. You can generate reports between any two dates you want.
Or are you asking how to get the date information from the user?? Perhaps the DatePicker control in the ToolBox?
Your question is pretty vague so it's difficult to come up with a proper answer.
|
|
|
|
|
Very vague, I understand and apologize. My only concern with simply storing the info as date in the db is that I want the program to upon loading, select certain records, say for the current month or current year, and perform some basic mathematical calculations etc. So with my extremely limited programming knowledge, I guess I am not sure how I could go about pulling say 3 of 10 records based on the current month I am in or current year etc. Does that help or only make only more vague =]
|
|
|
|
|
It barely helps, but you're just retrieve records for the current month quite easily. Code the SQL query to retrieve records between two dates. You first generate a date using the current month and year, just adding the 1st of the month to create something like 5/1/2009. Your second date would be todays date. Then use those as the bounds for the query and retrieve youre records. You can even do some of the math in the query if need be.
But, if you're new to programming, I would seriously pickup a beginners book on VB.NET before going forward with this project. The .NET Framework is pretty huge and there's a lot to learn that can make it much easier to code your app instead of guessing at things.
|
|
|
|
|
Hi all
in VFP, When I begin to work with a project, I create control that is a subclass of it is baseclass, then I code what I want to this subclass, then I drag it and put it on the form. and I use this subclass in all my forms later on.
Now to make that in vb.net I found the UserControl is the closet control to do what I want.
Q1: Is UserControl is the right direction to achieve what I want?
I have did some tests on UserControl and I have these questions
1- Why it gives warning in 'Me.Version = "1.0"
2- Why it gives warning and my vb crashes and could not be restarted unless I close all vb IDE's in Version = value
3- Should I assign a new variable (m_version) for each property I want to add? Cannot I work directly with property?
4- When I drag the control to my form, I notice that the control (Textbox) (width and height) are not expanded to take the the Length and Height of the Usercontrol. Should I handle that manually?
5- I have included many code in the Get, so I would like to know what is the best I should use.
Public Class UserControl1 ' I add Textbox
Dim m_Version
Property Version()
Get
'Version = "1.0" ' Worked Fine
'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
'Return "1.0" ' Worked Fine
Return m_Version ' Worked Fine
End Get
Set(ByVal value)
m_Version = value ' Works Fine
'Version = value ' Warning 3 Expression recursively calls the containing property 'Version'.
End Set
End Property
End Class
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Case sensativity, Version is a property and you're using it as a variable, so Version = value wouldn't work, I'm assuming your Version property is referencing m_Version, a private variable that the property Version reflects on.
Samir Ibrahim wrote: 'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths.
will not work, nor should it, you should use
Return m_Version
which is your private variable
Consider the property Version as an interface to your m_Version variable, you do not change the Property but merely what the Property reflects.
|
|
|
|
|
Thank you. Appreciated your answer.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: 1- Why it gives warning in 'Me.Version = "1.0"
Because the Get part of the property must return a value to the caller and your code apparently doesn't do that. Since a Version property should never be set by a caller, your code should read, as a ReadOnly property:
Public Class MyControl
Private Const m_Version As String = "1.0"
Public ReadOnly Property Version() As String
Get
Return m_Version
End Get
End Property
End Class
Seriously, pick up a beginners book on VB.NET. The problem you're having has nothing to do with subclassing or anything of the sort. You're missing a basic understanding of how Properties work.
|
|
|
|
|
You know something?
It became hard for someone to ask simple question and he got an answer without the person who answer the question show his arrogance and he know to much and he reads a lot of books and all should do as he did.
well, I have something to say to you, I am not a beginner, I know classing and subclassing more than you can imagine. 6 month of learning vb.net and i finished my first sql server vb.net application and my company work on it now.
Search for "imdb dll" or "imdb.dll" in google, it is a dll based on class i create it.
I was in top contributor in many vfp forums, and i am giving help in vb.net forums as well.
It seem the person should be as***le and super arrogance in order to get some respect.
-if Return Version is wrong then this is bu***hit design
-If Every Property should be replaced by a variable, that is bu***hit design
-If creating a UserControl and put some coding in it, and then drag this Usercontrol to a form and the code written in the UserControl design being executed in the form, well if that is not subclassing I wonder what it is.
Dave Kreskowiak wrote: pick up a beginners book on VB.NET
I will follow your advice and get a beginner vb.net book plus a milk biberon
I had enough of asking help in here.
Thanks.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: You know something?
It became hard for someone to ask simple question and he got an answer without the person who answer the question show his arrogance and he know to much and he reads a lot of books and all should do as he did.
well, I have something to say to you, I am not a beginner, I know classing and subclassing more than you can imagine. 6 month of learning vb.net and i finished my first sql server vb.net application and my company work on it now.
Search for "imdb dll" or "imdb.dll" in google, it is a dll based on class i create it.
I was in top contributor in many vfp forums, and i am giving help in vb.net forums as well.
It seem the person should be as***le and super arrogance in order to get some respect.
Excuse me, but where was I "super arrogant"?? I'm not out here try to grab respect. I'm out here trying to help people WHO WANT IT. IMHO, it's your response here that is "super arrogant".
I pointed out that you don't have a basic understanding of how Properties work, which is beginner-level knowledge. If you can't accept that, I'll just throw you on my blacklist of people I'll never help again.
Samir Ibrahim wrote: -if Return Version is wrong then this is bu***hit design
Excuse me, but you wrote that code, not me. If you want to say that VB.NET's syntactic requirements are bullshit, go back to writing VFP code...
Samir Ibrahim wrote: -If Every Property should be replaced by a variable, that is bu***hit design
I never said that. Every property has to support either a Gettor, a Settor, or both. Either/Both of which much be backed by a constant, a variable, or some other storage, to make the property usefull. If you understood the basics of Properties, you never would have said what you did.
Samir Ibrahim wrote: -If creating a UserControl and put some coding in it, and then drag this Usercontrol to a form and the code written in the UserControl design being executed in the form, well if that is not subclassing I wonder what it is.
I never said that wasn't subclassing. I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.
Samir Ibrahim wrote: I will follow your advice and get a beginner vb.net book plus a milk biberon
I had enough of asking help in here.
Fine, I'll throw you on the blacklist then. I'm not the one being super arrogant.
|
|
|
|
|
Dave Kreskowiak wrote: I'm not out here try to grab respect
Maybe/Maybe not. But you got mine.
Dave Kreskowiak wrote: I pointed out that you don't have a basic understanding of how Properties work
I know how property work and should work. I just HATE how property work in vb.net
Dave Kreskowiak wrote: Samir Ibrahim wrote:
-if Return Version is wrong then this is bu***hit design
Excuse me, but you wrote that code
Yes I write that code in my app and it gives error which is not logical error in my understanding of how PEM's should work in a class. I did not say you write that neither you mention it. That was an expression of my thought.
Dave Kreskowiak wrote: I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.
What/Where is my problem in my code?
Did you notice the remark ' I put in front of the lines? did you notice the remark I put after the ' "works fine" or "gives warning", I managed to make the property work before I ask this question. I read and search google and reading in 3 books and when I sleep and I dream That I am searching google.
All I was asking is "Why it is giving warning"
It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch.
In my stupid mind, when you are working in class and you code Me.Version or just Version , LOGICALLY they both should point to the same property. Yes I find that not logical and has no reason to give error.
Eventually, You was right. I DON'T UNDERSTAND HOW PROPERTY WORK IN VB.NET
The capital letter is for emphasizing not shouting.
Dave Kreskowiak wrote: Excuse me, but where was I "super arrogant"??
I had one point to fix about "as***le and super arrogance"
I did not mean to say that about you, I am saying that about the Post Owner PO. although after reading my post it seems like it is towards you.
Sorry for that, A thought in mind translated in wrong way. please accept my apology.
In short, 15 years programming experience, I cannot accept "read beginner book" as an answer, but I can accept "Vb.net Work Like that either you like or no"
I am feeling nervous and upset from my self not from you.
Sorry.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch
Okay Doofus, explain why, if your elite skills are so good, you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned?
Let's go back to OO school:
Getter methods are used to RETURN a value without changing anything.
Setter methods are used to CHANGE a value without returning anything.
Which bit do you not understand? This is NOT VB.Net nor M$, it's first principles.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
williamnw wrote: you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned?
Where I mention that I am not returning a value for the function? show me.
here is my question
Public Class myclass1
Function Sum()
Sum = 1 + 2 ' <-- Works Fine
Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
End Function
End Class
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
0. No question, just a statement.
1. the first line is assigning the value that will be returned:
Samir Ibrahim wrote: Sum = 1 + 2 ' <-- Works Fine
2. The second line is trying to assign a new value to the what would be returned:
Samir Ibrahim wrote: Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
Your whole reference point is wrong. With every post you are showing more ignorance and less ability. These are not new concepts, they have not changed for a long time. The example given, with a bit of editing, wouldn't have worked in any version of VB since classes came in in VB4
You failed to ask a very basic question. When given the best possible answer you ranted back.
In summing up My Lord, I submit that the defendant is indeed a Doofus and should be shown no mercy. The case for the prosecution rests.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Public Class myclass1
' It's "best practice" to explicitly declare visibility of the Function and to
' define it's return type if you're not using LINQ, or some other technology
' that will try to imply the return type for you based on possible values that
' the code might return.
Public Function Sum() As Integer
' You haven't defined Sum anywhere, except as a function name. VB6 supported just
' treating the function name as the return value holder. You should NOT be using
' practice in VB.NET. It is only there for backward compatibility with converted
' VB6 code.
Sum = 1 + 2 ' <-- Works Fine
' Now you're treating Sum not as a variable, as in the previous line, but as an object
' or property. This will not work since Sum, outside of it's own code, cannot be
' as a variable since, in true OOP, it's a method name.
Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
' It is considered "best practice" to explicitly declare a single Return statement.
Return x
End Function
End Class
Serisouly, VB6 and VFP have taught you some very bad habits that are not supported in the true OOP world of VB.NET. I still highly recommend picking up a book on VB.NET so you can learn how the basics are really supposed to work, instead of the garbage VFP taught you.
|
|
|
|
|
Samir Ibrahim wrote: I know how property work and should work. I just HATE how property work in vb.net
I works exactly the same as it does in any .NET lanuage, be it Managed C++, C#, VB.NET, ... It's very standard and doesn't deviate from accepted norms in other languages outside the .NET environment. So, I fail to understand how you find the functionality or structure of a VB.NET Property weird.
Samir Ibrahim wrote: I cannot accept "read beginner book" as an answer
There are other uses for books like that, such as being a reference when converting code/concepts from other languages to VB.NET.
Yeah, I saw all the ' marks in your code snippet. It looked as though you were guessing, trying to figure out how properties worked. Properties are a very basic concept in .NET, so that's why the book suggestion.
The rest, I'm not going to touch.
|
|
|
|
|
Samir Ibrahim wrote: I know classing and subclassing more than you can imagine
Samir Ibrahim wrote: 6 month of learning vb.net
My career is a mix of low level embedded, hardware and software overy thirty years and there is a lot I can learn from Dave.
His point was valid.
|
|
|
|
|