问题列表 - 第41879页

Windows表单应用程序异常

我得到应用程序异常

   at System.Windows.Forms.CurrencyManager.get_Item(Int32 index)
   at System.Windows.Forms.CurrencyManager.get_Current()
   at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter(DataGridViewCellEventArgs e)
   at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred)
   at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick)
   at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown)
   at System.Windows.Forms.DataGridView.OnCellMouseDown(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnMouseDown(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, …
Run Code Online (Sandbox Code Playgroud)

c# sql entity-framework datagridview winforms

7
推荐指数
1
解决办法
7697
查看次数

在TextBox中更改滚动条位置?

如果我想更改TextBox滚动条的位置,除此之外我还需要做什么:

SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw);
Run Code Online (Sandbox Code Playgroud)

此函数仅更改滚动条位置,但不更新实际TextBox(因此滚动条"滚动",但文本不会).有什么建议?我在Visual Studio 2008中使用Windows Forms和.NET 4.

.net c# c++ scrollbar winforms

6
推荐指数
2
解决办法
1万
查看次数

将switch语句组合在一起?

我可能在寻找一些东西,但在C++中是否有一种简单的方法可以将案例分组在一起而不是单独写出来?我记得基本上我可以做到:

SELECT CASE Answer
CASE 1, 2, 3, 4
Run Code Online (Sandbox Code Playgroud)

C++中的示例(对于那些需要它的人):

#include <iostream.h>
#include <stdio.h>
int main()
{
   int Answer;
   cout << "How many cars do you have?";
   cin >> Answer;
   switch (Answer)                                      
      {
      case 1:
      case 2:
      case 3:
      case 4:
         cout << "You need more cars. ";
         break;                                        
      case 5:
      case 6:
      case 7:
      case 8:
         cout << "Now you need a house. ";
         break;                                        
      default:
         cout << "What are you? A peace-loving hippie freak? ";
      }
      cout << …
Run Code Online (Sandbox Code Playgroud)

c++ switch-statement

29
推荐指数
6
解决办法
9万
查看次数

正则表达式在vim中搜索

我正在使用vim在文本文件上进行一些模式匹配.我启用了搜索突出显示功能,以便确切地知道每次搜索时匹配的内容,并且我感到困惑.

考虑搜索[a-z]*以下文字:

123456789abcdefghijklmnopqrstuvwxyxz987654321ABCDEFGHIJKLMNOPQRSTUVWQXZ

我希望此搜索匹配[az]范围内的零个或多个连续字符.相反,我在整条线上获得了一场比赛.

这应该是预期的行为吗?

谢谢,

安德鲁

regex vim

2
推荐指数
1
解决办法
179
查看次数

这段代码中抛出的异常是什么:

public class Testex
{
    public static void main ( String[] args ) {
       double [] scores = new double [5];
       scores [5] = 95.75;

    }
}
Run Code Online (Sandbox Code Playgroud)

我不知道这里抛出了什么异常,请帮忙

java exception

0
推荐指数
2
解决办法
90
查看次数

<function>的多重定义

/tmp/ccTQFVCP.o: In function `whiteSpace':
/home/tommo/fly/flyc/config.c:12: multiple definition of `whiteSpace'
/tmp/cc0ccMfz.o:/home/tommo/fly/flyc/config.c:12: first defined here
/tmp/ccTQFVCP.o: In function `lineEnd':
/home/tommo/fly/flyc/config.c:16: multiple definition of `lineEnd'
/tmp/cc0ccMfz.o:/home/tommo/fly/flyc/config.c:16: first defined here
/tmp/ccTQFVCP.o: In function `makeSubStr':
/home/tommo/fly/flyc/config.c:20: multiple definition of `makeSubStr'
/tmp/cc0ccMfz.o:/home/tommo/fly/flyc/config.c:20: first defined here
Run Code Online (Sandbox Code Playgroud)

我在我的文件config.c中的每个函数都得到了这个

我的每个头文件都有一个#ifndef FILE_H头块.

它为什么这样做?

TARGET   = fly
SRC      = main.c gfx.c transform.c entity.c list.c v3.c config.c airplane.c
CPPFLAGS = -Wall 
LDFLAGS  = -lglfw -lGL -lGLU
DEBUG    = -g

linux: 
    @echo Building for Linux...
    gcc $(CPPFLAGS) $(DEBUG) $(LDFLAGS) $(SRC) -o $(TARGET)
    @echo …
Run Code Online (Sandbox Code Playgroud)

c gcc

1
推荐指数
1
解决办法
3285
查看次数

C++模板可以很好地与VCL类一起使用吗?

我正在尝试使用C++模板'mixins'来创建一些具有共享附加功能的新VCL组件.例...

template <class T> class Mixin : public T
{
private:
  typedef T inherited;

// ...additional methods

public:
  Mixin(TComponent *owner) : inherited(owner)
  {
  // .. do stuff here
  };
};
Run Code Online (Sandbox Code Playgroud)

像这样使用:

class MyLabel : public Mixin<TLabel>
{
  ....
}

class MyEdit : public Mixin<TEdit>
{
  ....
}
Run Code Online (Sandbox Code Playgroud)

现在,一切编译都很好,mixin的东西似乎工作 - 直到我尝试使用TStream-> WriteComponent将组件保存到流中,其中继承的属性(例如TLabel.Width/Height/etc.)不会被写入.即使使用如上所示的'null'mixin也是如此.

直接从TForm,TEdit等派生类时,我的代码工作正常 - 并且该类已正确地注册到流系统.

delphi templates vcl c++builder

3
推荐指数
1
解决办法
611
查看次数

将Java与Objective-C进行比较的资源(语法和基础知识)

在过去一年半的时间里,我自学了很多Objective-C,甚至能够在App Store上发布一些iOS应用程序.关于面向对象编程之前对我来说很陌生的概念现在是第二天性,我理解MVC,继承,多态等等.我现在有兴趣学习Android平台的开发,这将需要学习Java.我希望在Objective-C世界中找到与语法和结构相关的Java基础知识的资源.

Objective-C的维基百科条目正是我正在寻找的关于Objective-C如何与C++相关的内容.如果有一篇关于Objective-C的文档,博客文章或专门用于Java的书籍,我将会像蜂蜜一样对待它.它应该包括像

  • 类方法声明和实现
  • 实例方法声明和实现
  • 如何撰写方法名称(即+/-(returntype)methodName :( type)参数;)
  • 声明属性

谢谢你的所有建议!

java programming-languages objective-c

5
推荐指数
1
解决办法
3565
查看次数

Pyparsing:如何解析数据然后编辑.txt文件中的特定值?

我的数据位于.txt文件中(不,我无法将其更改为其他格式),它看起来像这样:

varaiablename = value
something = thisvalue
youget = the_idea

这是我到目前为止的代码(取自Pyparsing中的示例):

from pyparsing import Word, alphas, alphanums, Literal, restOfLine, OneOrMore, \
empty, Suppress, replaceWith

input = open("text.txt", "r")
src = input.read()

# simple grammar to match #define's
ident = Word(alphas + alphanums + "_")
macroDef = ident.setResultsName("name") + "= " + ident.setResultsName("value") + Literal("#") + restOfLine.setResultsName("desc")
for t,s,e in macroDef.scanString(src):
print t.name,"=", t.value
Run Code Online (Sandbox Code Playgroud)

那么如何告诉我的脚本编辑特定变量的特定值?
示例:
我想将variablename的值从value更改为new_value.所以基本上是变量=(我们想要编辑的数据).

我可能应该明确表示我不想直接进入文件并通过将值更改为new_value来更改值,但我想解析数据,找到变量然后给它一个新值.

python pyparsing

6
推荐指数
2
解决办法
1554
查看次数

使用PhP加密存储在MySql中的密码的最佳做法是什么?

我正在寻求有关如何使用PHP在MySQL中安全存储密码的建议.

忽略了PHP本身的局限性,我想了解更多关于盐水,散列和加密这些坏男孩的信息.

显然人们将继续使用弱密码,除非被迫做其他事情,但这就是我存储它们对我来说很重要的方式.我的用户密码对我来说比数据库本身更重要,因此我希望以这样的方式保留它们,这对任何试图反向的脚本小子都是徒劳和单调的.显然,尽职尽责,任何事都可以被打败,但我不介意让这件事特别麻烦.

我们正在研究两种情况.

  1. 小子有一份完整的数据库副本.
  2. 小家伙拥有用于制作密码的PHP的完整副本和数据库.

关于这个主题的任何和所有建议都得到了慷慨的赞赏.

php mysql security passwords

16
推荐指数
2
解决办法
2万
查看次数