index查找选择控件中的索引超出范围

时间:2017-04-26 05:05:28

标签: c#

我有一个查找控件和按钮控件 查找控制代码是: -

import React, {
    Component,
} from 'react';
import {
    AppRegistry,
    ListView,
    StyleSheet,
    Text,
    TouchableOpacity,
    TouchableHighlight,
    View,
    Alert,
    Dimensions
} from 'react-native';

import { SwipeListView, SwipeRow } from 'react-native-swipe-list-view';
var alertMessage="You want to Delete it";
var alertMessage1='why press it'
var v1=1.0;
const wid=Dimensions.get('window').width;
export default class App extends Component {
    constructor(props) {
        super(props);
        this.ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
        this.state = {
            basic: true,
            listViewData: Array(5).fill('').map((_,i)=>`item #${i}`)
        };
    }
    deleteRow(secId, rowId, rowMap) {
        rowMap[`${secId}${rowId}`].closeRow();
        const newData = [...this.state.listViewData];
        newData.splice(rowId, 1);
        this.setState({listViewData: newData});
    }

    // undoRow(rowId) {
    //  const newData = [...this.state.listViewData];
    //  this.setState({listViewData: newData});
    //  this.setState({listViewData: newData});
    // }
    render() {
        return (

                    <SwipeListView
                        dataSource={this.ds.cloneWithRows(this.state.listViewData)}
                        renderRow={ data => (

                            <TouchableHighlight
                                onPress={ _ => Alert.alert(
            'Alert Title',
            alertMessage1,
          ) }
                                style={styles.rowFront}
                                underlayColor={'#AAA'}
                            >
                                    <Text>I am {data} in a SwipeListView</Text> 
                            </TouchableHighlight>
                        )}

                        renderHiddenRow={ (data, secId, rowId, rowMap) => (
                            <View style={styles.rowBack}>   

                                <TouchableOpacity style={{backgroundColor:'#2c3e50',alignItems: 'center',bottom: 0,justifyContent: 'center',position: 'absolute',top: 0,width: 75}} 
                                onPress={ _ =>  rowMap[ `${secId}${rowId}` ].closeRow() }   >
                                    <Text style={styles.backTextWhite}>Undo</Text>
                                </TouchableOpacity>

                                <TouchableOpacity style={[styles.backRightBtn, styles.backRightBtnRight]} 
                                    onPress={ _ => Alert.alert(
                                     'Are You Sure',alertMessage,
                                      [{text: 'OK', onPress: () =>this.deleteRow(secId, rowId, rowMap)},
                                        {text: 'Cancel',}]
          ) }>
                                    <Text style=

    {styles.backTextWhite}>Delete</Text>
                                    </TouchableOpacity>
                                </View>
                            )}
                            leftOpenValue={wid}
                            rightOpenValue={-wid}                       
                            disableLeftSwipe={true}

                        />
            );
        }
    }
    const styles = StyleSheet.create({
        container: {
            backgroundColor: 'white',
            flex: 1
        },
        standalone: {
            marginTop: 30,
            marginBottom: 30,
        },
        standaloneRowFront: {
            alignItems: 'center',
            backgroundColor: '#CCC',
            justifyContent: 'center',
            height: 50,
        },
        standaloneRowBack: {
            alignItems: 'center',
            backgroundColor: '#8BC645',
            flex: 1,
            flexDirection: 'row',
            justifyContent: 'space-between',
            padding: 15
        },
        backTextWhite: {
            color: '#FFF'
        },
        rowFront: {
            alignItems: 'center',
            backgroundColor: '#CCC',
            borderBottomColor: 'black',
            borderBottomWidth: 1,
            justifyContent: 'center',
            height: 50,
        },
        rowBack: {
            alignItems: 'center',
            backgroundColor: '#DDD',
            flex: 1,
            flexDirection: 'row',
            //justifyContent: 'space-between',
            paddingLeft: 15,
        },
        backRightBtn: {
            alignItems: 'center',
            bottom: 0,
            justifyContent: 'center',
            position: 'absolute',
            top: 0,
            width: 75
        },
        backRightBtnLeft: {
            backgroundColor: 'blue',
            //right: 75
        },
        backRightBtnRight: {
            backgroundColor: '#2c3e50',
            right: 0
        },
        controls: {
            alignItems: 'center',
            marginBottom: 30
        },
        switchContainer: {
            flexDirection: 'row',
            justifyContent: 'center',
            marginBottom: 5
        },
        switch: {
            alignItems: 'center',
            borderWidth: 1,
            borderColor: 'black',
            paddingVertical: 10,
            width: 100,
        }
    });

     App.navigationOptions = {
         title: 'Signup Screen',
        headerVisible:false  
     };

    AppRegistry.registerComponent('TabNavigator', () => App);

按钮控制代码是: -

private void  ViewlookupControl_SelectionControlMultiple(DataGridViewSelectedRowCollection vDataGrid)
{
    try
    {
        if (vDataGrid.Count > 0)
        {
            itemtxt.Tag = Convert.ToInt32(vDataGrid[0].Cells[2].Value.ToString());
            itemtxt.Focus();
            clsDataV12 clsdata2 = new clsDataV12();
            SqlParameter[] sqlp4 = new SqlParameter[1];
            sqlp4[0] = new SqlParameter("@intAutoNo", Convert.ToInitemtxt.Tag.ToString()));
            DataTable dt4 = new DataTable();
            dt4 = clsdata2.GetRecordsetParams("bomselectmaster", sqlp4);
            if (dt4.Rows.Count > 0)
            {
                DataRow dr = dt4.Rows[0];
                itemtxt.Text = ((dr["chrItemCode"] == System.DBNull.Value) ? "" : dr["chrItemCode"].ToString());
                definedtxt.Text = ((dr["numDefinedFor"] == System.DBNull.Value) ? "" : dr["numDefinedFor"].ToString());
                BOMdateTimePicker.Text = ((dr["dtmAppliFrom"] == System.DBNull.Value) ? "" : dr["dtmAppliFrom"].ToString());
            }

问题是,当我在查找控件中选择项目时,它会显示rang中的索引。必须是非负数且小于collection.parameter name:index

的大小

0 个答案:

没有答案