|
No problem in your query which fills up the Combo just add one clause order by id desc and it will show you the last value
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
opps sorry. thats not what i mean. its not the last value item. its the selected item. meaning, if i have items 'a','b','c','d', and so on... then user select b then save to db.
then close form. when re-open form. the value of combo shud b or whatever. what i want is like a normal combo.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
SelectedIndex , SelectedItem,SelectedText,SelectedValue will do the job
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
I have a datagridview with a DataGridViewComboboxColumn column with 3 values:
"Small", "Medium", "Large"
I get back the users default which in this case is "Medium"
I want to show a comboboxcell in the datagridview but default the value to "Medium". i would do this in a regular combobox by doing selected index or just setting the Text property of a combo box.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
I am trying to write the data in Textbox1 to a certain location in the text file say 10 lines down and 10 line to the right
is this posible with streamWriter ??
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("c:\test.txt", True)
file.WriteLine(TextBox1.Text)
file.Close()
End Sub
|
|
|
|
|
Bob Beaubien wrote: is this posible with streamWriter
Yes... and No.
Yes you can write to a text file, you can even read in the first 9 lines and then write your info into the 10th line.
No you can't write the 10th line to the right you can of course insert 10 spaces before the textbox info.
|
|
|
|
|
Right on how would i do that ??? if you dont mind me asking
Pleasse and thanks
|
|
|
|
|
Excuse the sarcasm - we really need a rude/sarcasm icon
You know how to use the stream writer
You are using writeline - I assume you can count to 10
If you cannot add 10 spaces to the left of the textbox.text then there is no hope at all.
when finished remember to add stream.close() (you don't need flush() - thank you Luc).
I hope I'm not feeding a troll, your question is so basic it does make me wonder.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I tryed that it did not work just just moves right back i guess it would probably be easyer using a excel spredcheet and remove the lins when printing
|
|
|
|
|
I regret the inconvenience caused with the lengthy code pasted earlier.I'll put my query again.
I am using a front end to enter some records.However for a particular record the update button is greyed out.
code for update button.
Private Sub cmdUpdate0_Click()
Dim strAgreeStatus As String
Call m_frmParent.ZOrder(0)
strAgreeStatus = txtText0(idxMaintAgreeStatus).Text
If Edit_Neg > 0 Then
Exit Sub
End If
If Edit_Agree > 0 Then
Exit Sub
End If
On Error GoTo ERR_ROUTINE
Me.MousePointer = vbHourglass
If strAgreeStatus = "A" Then
m_objAgreement.DoFullEdits = "Y"
Else
m_objAgreement.DoFullEdits = "N"
End If
FMain.staMain.Panels(1).Text = ""
DoEvents
If ValidateAll0 > 0 Then
FMain.staMain.Panels(1).Text = "Unable to Update. Check fields in red."
GoTo SUBEND
End If
DoEvents
If m_objAgreement.Update < 1 Then
Call MsgBox("Agreement not found. " & vbCrLf & _
"", vbExclamation & vbOKOnly, "Unable to Update.")
Else
cboCombo0(idxMaintAgreementType).SetFocus
FMain.staMain.Panels(1).Text = "Update Successful."
End If
SUBEND:
cboCombo0(idxMaintAgreementType).SetFocus
Me.MousePointer = vbNormal
Exit Sub
ERR_ROUTINE:
If Err.Number = boAgreeErrRequired Then
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Required Data Missing")
ElseIf Err.Number = boAgreeErrValidation Then
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Data Validation Error")
Else
Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Error")
End If
Me.MousePointer = vbNormal
End Sub
Thanks in advance.
~Varun
|
|
|
|
|
From what you have said, I do not believe the problem is within the click event of the updaste Button.
I would suggest you use a breakpoint and step through you code and pay particular notice to anything where the Enabled property of the update button is used.
I noticed you used a GoTo command. Tut Tut, bad coding. Avoid using them, they only lead to bad code.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Thanks for your response Steve..Havn't tried it yet but definitely share it with you..Regarding the GoTo..well the code is legacy code so can't do much
Thanks
~Varun
|
|
|
|
|
Thanks a ton Steve.. My problem has been solved after a little exploration in the enable conditions.
Regards
Varun
|
|
|
|
|
Buggedforever wrote: DoEvents
Eeekkk
Buggedforever wrote: On Error GoTo ERR_ROUTINE
AAHHHHhhhh
Buggedforever wrote: GoTo SUBEND
AAAHHhhhhhh
Sorry, I was not expecting VB6, I need a shower, ergh.
There is a rule that discourages answerers from being sarcastic and rude but I just can't help it - VB6 make my skin crawl.
|
|
|
|
|
Mycroft Holmes wrote: I was not expecting VB6
Took me a couple of seconds to recoil in horror myself
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
hi,
I have a numericupdown control, I want users be able to increase its value by 0.15 (15 minutes)
and when it reaches 60 it becomes 1,
actually it works but only when user increase it, for example if its 1.30 and user decrease it it will be 0.85, I know my code has problem but I dont know how to solve it
can someone help me?
|
|
|
|
|
Shaahinm wrote: can someone help me?
Only if you post your code.
Alan.
|
|
|
|
|
Dim s As Decimal = 0.6
Private Sub nupS_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nupS.ValueChanged
If (nupS.Value Mod s) = 0 Then
nupS.Value = CDec(CInt(nupS.Value))
s += 1
End If
End Sub
|
|
|
|
|
And what is the problem?
if you set the step value to 0.15 it would increment like so:
0.00
0.15
0.30
0.45
0.60 assume this magically changes into 1.00
1.15
1.30
1.45
1.60 magic required ==> 2.0
and decrement like this:
2.30
2.15
2.00
1.85 assume this magically changes into 1.45
1.30
1.15
1.00
0.85 magic required ==> 0.45
0.30
0.15
0.00
So all that is needed is two lines of code, according to these rules:
if fraction==0.60 add +0.40
if fraction==0.85 add -0.40
Put something to that effect inside the valuechanged handler.
Warning: if the control would allow a paste, all kinds of nasty things could happen...
|
|
|
|
|
thank you man,
the problem is that I am not able to find out whether user is increasing the value or decreasing it
Should I store its value and check it when the value changed???
or is it possible to use delegates and events.
|
|
|
|
|
Shaahinm wrote: the problem is that I am not able to find out whether user is increasing the value or decreasing it
did I need that information in the two rules:
if fraction==0.60 add +0.40
if fraction==0.85 add -0.40
???
|
|
|
|
|
Anyone know a good free easy to use tool to created and edit pdf files ???
Thanks
|
|
|
|
|
There are lots of Good and Free Libraries for PDF files. I do not know any easy ones though!
I would suggest that you google for c# free pdf libraries and read their documentation and select the one that you understand the most.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
This is one of the method but i did in vb.net
here is the link to change the vb code to c code
http://www.google.com.bh/search?hl=en&source=hp&q=code+converter+vb+to+c&btnG=Google+Search&meta=&aq=2&oq=code+convert[^]
public void CrearPDF(DataSet ds, string nombrearchivopdf)
{
StrongTypedReport cr = new StrongTypedReport();
cr.SetDataSource(ds);
Stream input = cr.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
FileStream output = new FileStream(nombrearchivopdf,
FileMode.Create);
const int size = 4096;
byte[] bytes = new byte[4096];
int numBytes;
while((numBytes = input.Read(bytes, 0, size)) > 0)
output.Write(bytes, 0, numBytes);
output.Close();
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
That is excellent. I can do the same with some of the software that I have.
But it ain't free is it? This was one of the requirements of the OP.
The link to conversion the software search was a good idea, I don't need it personally, but others might find it useful.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|