Hi, when converting a string to double value i am losing my comma: Dim str as string Dim value as double set str = "123.451" value = CDbl(str)
output: 123451 anybody has a solution? happy coding, -mark
os win2000 vba office 2003, vc++ 6.0
macmac38
Posts
-
string to double -
seperate stringinput = "122.23, 232.0, 12.04" Dim i As Integer Dim str() As String str = Split(input, ",") For i = 1 To 3 value(i) = CDbl(str(i - 1)) Next Labelx.Caption = value(1) // 12223 Labely.Caption = value(2) // 2320 Labelz.Caption = value(3) // 1204
Yeah, this works. But why are the output values no float variables? happy coding, -mark
os win2000 vba office 2003, vc++ 6.0 -
seperate stringHi, confusing.. So how must be the code to read out the input string into the the double type text fields as shown below?
Dim input As Variant Dim value(1 to 3) AS double input = "122.23, 232.0, 12.04" . . . labelx.caption = value(1) //double 122.23 labely.caption = value(2) //double 232.0 labelz.caption = value(3) //double 12.04
happy coding, -mark
os win2000 vba office 2003, vc++ 6.0 -
seperate stringmmh, by the way do you have an VBA implementation? happy coding, -mark
os win2000 vba office 2003, vc++ 6.0 -
seperate stringThanks, i am using vba on excel 2003 happy coding, -mark
-
seperate stringHello, i like to seperate an incoming string to an array. The values are delimited by commas. input string format like "122.23, 232.0, 12.34" I think of using the split function:
Dim inputstr as variant list = split(inputstr,",")
After this i like to put the several values in double format variables. This require some typecasting, right? Does anybody has the syntax for the loop and the typecyasting? I am new to vb.. happy coding, -mark -
VBA Event handlingHello, i like to handle an event from an included libary: I use this code in my VBA project form1:
Private WithEvents mScandata As RealScan ------------------------------------------ Private Sub Form_Load() Set mScandata = New RealScan End Sub ------------------------------------------ Private Sub mScandata_ScanReady(ByVal pDobj As SCANNERLib.IDataObject) Dim i As Long For i = 0 To 250 MessageBeep (i) Next End Sub ------------------------------------------
This code doesen' t work. Does anybody has experience with event handling in vb? I think the prob is to initiate the m_Scandata event? happy coding, -mark -
Event in VBAHi, im new to VB. I like to interact with an registered activex control. F2 shows the analogous event ScanReady(occurs when datafile from scanner is at the clippboard) The tree is like:
Event ScanReady(pDobj As IDataObject)
|_
Class IDataObject:
Sub QueryGetData(pformatetc As tagFORMATETC)
|_
Type tagFORMATETCHow to implement a message shown in my form when data is avaible?? My idea is like this:
_________________________________________
Private Sub ScanReady()Dim pDobj As IDataObject
pDobj.QueryGetData (pformatec)
Label1.Caption = "Scandata avaible"
End Sub
_________________________________________Private Sub QueryGetData()
Dim pformatec As tagFORMATETC
End Sub
_________________________________________Can somebody help me? happy coding, -mark
-
activex events in a dllHello, i try to put a working code snip from an mfc .exe project into a .dll project. In the code an EVENTSINKMAP is linked to an activex control in my "old" mfc exe. The .dll should start working when an event occures from this activex control:
BEGIN_EVENTSINK_MAP(CSavepmjxApp, CWinApp) //{{AFX_EVENTSINK_MAP(CDsView) ON_EVENT(CSavepmjxApp, IDC_SCANCONTROL, 1 /* ScanReady */, OnScanReadyRealscan1, VTS_UNKNOWN) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP()
The compiler gives an error because IDC_SCANCONTROL is unknown in my .dll project. I like to use this .dll later in VisualBasic where i have my activex control again. How can i make this work?? happy coding, -mark -
Button controlHi all, i like to deactivate my Dialog Button IDC_STOP_ROBOT. Seems like no big deal, but when useing the syntax below nothing happens?
GetDlgItem(IDC_STOP_ROBOT)->EnableWindow(FALSE);
.. or enable again:
GetDlgItem(IDC_STOP_ROBOT)->EnableWindow(TRUE);
happy coding, -mark
-
website hacking :-(Hello all, in the meantime i know where the leak is.
if($id == FALSE){ include "home.php"; } else { include "$id"; }
this let you include any folder you like... you see i also can format my posting ;-) by the way do you know any good tutorials for php and html template working? I looked a some but this looks all like much script work in the background.. Thanks, Mark -
website hacking :-(Hello, i programmed a php based website for our company. Yesterday i was shocked to see that some polish hackers changed my index.php, but nothing else was touched. On their side they posted an article about this hack where they re talking about a php bug?? I took all php files from the server because i don't know wheres the security leak. here is the code of index.php:
 ";?> "; ?> deutsch / [english](\"$PHP_SELF?id=home.php&lang=en\") ";?>  $home";?> | $kontakt";?> | $impressum";?>  "; echo" "; echo" "; echo" "; echo"
-
stringBut this Byte output like: j which means no character in it? But the full string is arriving.. if i don't use this line: received[dwBytesRead] = '\0'; the output is: -0.714853,-0.192273jjjjjjjjjjjjjjjjj Thanks, Mark
-
cFileDialogallright, it works! Thanks, Mark
-
cFileDialogHello,
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST, "SI Projekte (*.3dsi)|*.3dsi |Alle Dateien (*.*)|*.*||", this);
i only like to show my .3dsi files, but this only shows folders? Thanks, Mark -
stringchar received[59]; port.Read(received, sizeof(received), overlapped, &dwBytesRead); TRACE( "Bytes read: %lu",dwBytesRead); received[dwBytesRead] = '\0'; SetDlgItemText(IDC_SHIFT_X, received);
Bytes read: 1 I donn't know where's the problem? Normaly it seems easy..? Like to solve it today ;-) Thanks, Mark -
stringchar received[40]; port.Read(received, sizeof(received), overlapped, &dwBytesRead); TRACE( "Bytes read: %d",dwBytesRead); received[dwBytesRead] = '\0'; SetDlgItemText(IDC_SHIFT_X, received);
Bytes read: 1Bytes read: -858993460Bytes read: -858993460Bytes read: -858993460 Thanks, Mark -
stringreceived[dwBytesRead] = '\0';
what does this line mean? I have "access violation" with this line. Thanks, Mark -
stringThis is the position string from a robot arm and every time the same format. x,y,z shift and quaternion 1-4 I have to extract them later from the string in float variables Thanks, Mark
-
stringyep, it seems to be better to use a reference. with this procedure my string output is only "0.1922" remember incoming: 924.09,-4.06,676.26,0.156488,-0.653856,-0.714853,-0.192273 It looks like that the first values running through the digits in the dialog..mmh?? Is this so complicate to give out the full string? Thanks, Mark