As so see, I wanna add the number from the UP1 textbox (The one shown "10")(ActiveXControl so it can be edited while presenting) to the S1 Textbox (Shown "10")
Here is my code:
Slide1.Shapes("S1").TextFrame.TextRange = Slide1.Shapes("S1").TextFrame.TextRange + UP1
But here is my result:
String values should be cast into numeric values before adding them.
With Slide1.Shapes("S1").TextFrame.TextRange
.Text = Val(.Text) + UP1
End With
Related
how i let my button know my text box value. i want to do is let my button know about my value when i insert 10 if i click + button will be 11 if i click - button will be 9 what should i do?
here is my addbtn code
i = i + 1
txtqty.Text = CStr(i)
this is my decrease btn code
i = i - 1
txtqty.Text = CStr(i)
You need to convert the content of the TextBox to an integer, perform your calculation and then reassign the calculated value back to the textbox
Dim value as Int
If Int32.TryParse(txtqty.Text, value) Then
value = value + 1
txtqty.Text = value.ToString()
else
MessageBox.Show("The textbox doesn't contain a valid number")
End If
Of course when you deal with user input you should take extra care on checking if the input is good for the task that you want to perform. Thus I have used Int32.TryParse that return false if the content of the textbox is not a valid integer number.
I'm using devexpress 11.1.4. version also xtraGrid control, my code is vb.net
I have set repositoryItemTextEdit to display mask into grid column. I whant to set date format:
"dd.mm.yyyy "
At the time of typing looks good , however when cells lose focus it changes in format:
"mm.dd.yyyy"
Also sometimes they just emptied or when i choose for example:
10.05.2015.
it change the value that it looks like this: 01.05.2015.
I do not know why
Here is my code:
Public dateWithTextEdit As RepositoryItemTextEdit = New RepositoryItemTextEdit
dateWithTextEdit .Mask.UseMaskAsDisplayFormat = True
dateWithTextEdit .Mask.AutoComplete = XtraEditors.Mask.AutoCompleteType.Strong
dateWithTextEdit .Mask.MaskType = XtraEditors.Mask.MaskType.DateTime
dateWithTextEdit .Mask.EditMask = "dd.mm.yyyy"
DGV.RepositoryItems.Add(dateWithTextEdit )
DGV.DataSource = dataTable
With dgvVIEW
.OptionsBehavior.AllowAddRows = DefaultBoolean.True
.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Top
.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.True
.Columns(0).Name = "PROMDDOK"
.Columns(0).FieldName = "PROMDDOK"
.Columns(0).Caption = "DATUM DOKUMENTA"
.Columns(0).ColumnEdit = dateWithTextEdit
.Columns(0).Visible = True
.Columns(0).Width = 120
End With
Problem no. 1.: your edit mask is dd.mm.yyyy. mm stands for minutes, you have to use dd.MM.yyyy.
If this doesn't help, set the column's display format as well.
Code in C#:
columns[0].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
columns[0].DisplayFormat.FormatString = "dd.MM.yyyy";
According to the DevExpress online documentation, RepositoryItemTextEdit.Mask Property is used to format cell values in edit mode.To format cell values in display mode, use solutions described in the Formatting Cell Values document.
I am new to VBA and wanted to ask if you could help me.
I have this VB6 code:
For i = 2 To rowCount - 2
' Fill Ji with a formula(=MID(Fi,11,9)) and apply format.
Set oRng = oSheet.Range(Cells(i, 10), Cells(rowCount - 2, 10))
**oRng.formula = "=MID(Cells(i,6),11,9)"**
oRng.NumberFormat = "[$-F400]hh:mm:ss"
Next i
I want to assign a formula to the range
Tried this code but, has a problem when I assign the formula. It doesn't recognizes the Cell(i,6) as Cell, but As string "Cell(i,6)".
Can anyone help me?
You don't want the loop as you're putting the formula into all cells at once:
' Fill Ji with a formula(=MID(Fi,11,9)) and apply format.
Set oRng = oSheet.Range(oSheet.Cells(2, 10), oSheet.Cells(rowCount - 2, 10))
oRng.formulaR1C1 = "=MID(RC6,11,9)+0"
oRng.NumberFormat = "[$-F400]hh:mm:ss"
Note: I added a +0 to your formula to convert text to true time values.
Try "=MID(" & Cells(i,6).Address(False,False) &",11,9)"
Include the Address part only if you want a relative reference
Good Day everyone i got a problem:
I have a form where user can add rows that will be passed to a table in ms word
when I cycle through all forms to add rows I call function
I insert new row into a table in my MS WORD document (from template)
when I try to add text to cells, it adding text to 1st row only!
this is how I do it:
Dim frame As Control
For Each frame In fillForm.MultiPage1.Pages(2).Controls
If TypeOf frame Is msforms.frame Then tablerowadd frame.Controls("krsName").Value, frame.Controls("krsMark").Value
Next frame
Public Function tablerowadd(krsName As String, krsmark As String) As Boolean
krsRow = krsRow + 1
With ActiveDocument.Tables(1)
.Rows.Add
.Cell(krsRow, 1).Range.Text = krsName
.Cell(krsRow, 2).Range.Text = krsmark
End With
End Function
krsRow is a public integer variable.
Can anyone tell me what am i doing wrong?
When I debug, I got krsRow = 2,3,4 etc..
But .Cell(krsRow, 2).Range.Text = krsmark always adds text to 1st row.
Please help!
So, it's quite easy, you need to refer to last row when inserting text. Therefore change inside part of the function into:
.Cell(.Rows.Count, 1).Range.Text = krsName
.Cell(.Rows.Count, 2).Range.Text = krsmark
as a result you inputs go to last row of the table.
If you change so you won't need to use your krsRow variable
I want to add a field via macro to my presentation/slide that automatically shows the current date.
Shape shape = [Find a text shape to edit]
shape.TextFrame.TextRange.Text = "Some Text | " + [Field showing Current date]
I don't want to insert a text that contains the current date:
Shape shape = [Find a text shape to edit]
shape.TextFrame.TextRange.Text = "Some Text | " + DateTime.Now
As I descriped the resulting textshape should contain some constant text + a field showing the current date.
This will insert a time/date field into your text box:
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh.TextFrame.TextRange
.Text = "Some text | "
.InsertDateTime ppDateTimeHmm, True
End With